highlight.source

highlight.source — Should the content of programlisting be syntactically highlighted?

Synopsis

<xsl:param name="highlight.source" select="0"></xsl:param>

Description

When this parameter is non-zero, the stylesheets will try to do syntax highlighting of the content of the programlisting element. The highlighting is done by the XSLTHL extension module. This is an external Java library which is not part of the DocBook XSL distribution.

In order to use this extension, you must add xslthl-2.0.0.jar to your Java classpath. You can download this software from the XSLT syntax highlighting project at SourceForge.

The configuration of syntax highlighting is stored in highlighting/xslthl-config.xml. The Java property xslthl.config or parameter highlight.xslthl.config must point to this file (using URL syntax).

This extension is known to work with Saxon 6.5.x, Saxon 8.5+ and Xalan-J. Here is an example of a modified Saxon command:

java -cp c:\batch\;…;c:\path\to\xslthl-2.0.0.jar -Dxslthl.config=file:///c:/docbook-xsl/highlighting/xslthl-config.xml … com.icl.saxon.StyleSheet …

You can specify the language for each programlisting by using the language attribute. The highlight.default.language parameter can be used for specifying the language to be used for programlistings without a language attribute.