DocBookXsltExtensions

Norman Walsh edited this page Oct 3, 2015 · 3 revisions
Clone this wiki locally

Extensions for Saxon and Xalan

The DocBook Saxon Extensions and DocBook Xalan Extensions are sets of DocBook-specific XSLT 1.0 extensions created by NormanWalsh for performing a variety of tasks:

  • Embed callouts in verbatim environments (program listings, for example)
  • Add line numbers to verbatim environments (program listings, for example)
  • Adjust the width of table columns in HTML output to match specs in the CALS table source
  • Directly include contents of a text file in rendered output
  • Determine the intrinsic size of an image

* Convert CVS date strings into local time

The above tasks are either impractical or impossible to implement with standard XSLT 1.0 only.

The extensions are written in Java and they can be used with Xalan-Java and Saxon extensions. For specific how-to instructions on using them, see the DocBook Xalan extensions and DocBook XSL: The Complete Guide sections in http://www.sagehill.net/docbookxsl/ .

Basically, to use the extensions, you need to:

  1. determine which extension jar file (in the extensions directory in the DocBookXslStylesheets distribution) corresponds most closely to the Java XSLT engine you use
  2. include the name of that jar file in your Java classpath
  3. set the correct XSLT extension parameters to enable the behavior you need. Here is documentation for the parameters for HTML output.

For example, if you are using Saxon 6.5.3, include the extensions/saxon65.jar file in your Java classpath, and (at a minimum) set the value of the use.extensions parameter to 1 (instead of the default 0).

Extensions for libxslt

There is no complete set of extensions that will work with the libxslt library (which is written in C and includes the xsltproc command line tool).

Currently, there is one libxslt extension: a Python implementation of a function that adjusts column-widths in CALS tables. See README.LIBXSLT for more information.