highlight.source
Prev | Miscellaneous | Next

## 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 `programlisting` elements. You specify the language for each programlisting by using the `language` attribute. The `highlight.default.language` parameter can be used to specify the language for programlistings without a `language` attribute. Syntax highlighting also works for `screen` and `synopsis` elements.

The actual highlighting work is done by the XSLTHL extension module. This is an external Java library that has to be downloaded separately (see below).

In order to use this extension, you must

- add `xslthl-2.x.x.jar` to your Java classpath. The latest version is available from the XSLT syntax highlighting project at SourceForge.

- use a customization layer in which you import one of the following stylesheet modules:

  - `html/highlight.xsl`

  - `xhtml/highlight.xsl`

  - `xhtml-1_1/highlight.xsl`

  - `fo/highlight.xsl`

- let either the `xslthl.config` Java system property or the `highlight.xslthl.config` parameter point to the configuration file for syntax highlighting (using URL syntax). DocBook XSL comes with a ready-to-use configuration file, `highlighting/xslthl-config.xml`.

The extension works with Saxon 6.5.x and Xalan-J. (Saxon 8.5 or later is also supported, but since it is an XSLT 2.0 processor it is not guaranteed to work with DocBook XSL in all circumstances.)

The following is an example of a Saxon 6 command adapted for syntax highlighting, to be used on Windows:

java -cp c:/Java/saxon.jar;c:/Java/xslthl-2.0.1.jar -Dxslthl.config=file:///c:/docbook-xsl/highlighting/xslthl-config.xml com.icl.saxon.StyleSheet -o test.html test.xml myhtml.xsl

Prev | Up | Next
table.footnote.number.symbols | Home | highlight.xslthl.config