The following is an example of syntax highlighting through xslt using xslthl . The following Xslt processor was used: SAXON 8.7 from Saxonica ( http://www.saxonica.com/ )

Tcl code

Example tcl code

		
#!/usr/bin/tclsh

# 99.tcl; Tcl version of 99 Bottles of Beer Song

proc findBString { count } {
  return [switch -exact -- $count {
    0       { expr {"No more bottles"}  }
    1       { expr {"1 bottle"}         }
    default { expr {"$count bottles"}   }
  }]
}

set bottles 99
set bString [findBString $bottles]
while {$bottles + 1} {
  puts "$bString of beer on the wall.  $bString of beer."
  incr bottles -1
  if {$bottles + 1} {
    set bString [findBString $bottles]
    puts "Take one down, pass it round, $bString of beer on the wall.\n"
  } else {
    puts "Go to the store and buy some more...99 bottles of beer."
  }
}
		
	

Origin: http://www.99-bottles-of-beer.net/language-tcl-797.html

Additional examples

		
# keywords starting with an '-' are not keyword		
proc -proc { -switch } {
  switch -exact -- $-switch {
    0       { expr {"No more bottles"}  }
    1       { expr {"1 bottle"}         }
    default { expr {"$count bottles"}   }
  }
}		
		
	

Generated by: SAXON 8.7 from Saxonica ( http://www.saxonica.com/ ) - Xslt version: 2.0