Chapter 15. Using XSL Stylesheets

Currently using XSL stylesheets to generate output of XML files is not as well supported as using DSSSL style sheets. This is because XSL stylesheets are not as customized as DSSSL ones, and XSL tools are not as widely used, and standardized.

At this time there are no XSL specific targets in Makefile. This is because there are not standardized ways to invoke XSLT processors. To use XSL stylesheets you must run the configure script and tell it, where your copy of XSL DocBook Stylesheets is placed. The majority of XSLT processors require an URL instead of a filename, so be sure to prepend the file:/// schema before path:

$ autoconf
$ ./configure --with-xsl=file:///path/to/docbook/xsl/styles

Note: The above --with-xsl=file:///path/to/docbook/xsl/styles form won't work with cygwin, because it tries to check for the existance of the style sheet, and cygwin cannot interpret this kind of file path. So there is a temporary --with-mxsl=file:///path/to/docbook/xsl/styles method to use under cygwin, as long as we are unable to find the common right method. Please also note, that the file path values generated into entities/file-entities.ent by configure will also be problematic with current XSLT tools, so you need to convert them to use this file:///absolute/path/filename.xml form before running any XSLT processors... After going through all these your XSLT tool will be able to generate the output correctly under cygwin.

Configure will create four files: html.xsl, bightml.xsl, htmlhelp.xsl, print.xsl among others. These files can be used to generate the desired output. html.xsl generates a set of small HTML files, bightml.xsl generates one large HTML file, htmlhelp.xsl generates source files processable by HTML Help Workshop and print.xsl generates a file with FO objects suitable for further processing with some FO processor.

Note: The htmlhelp.xsl is currently not too useful alone, as it's used by the new CHM build system which is not available in CVS right now.

Invocation of XSLT processor is processor dependent, for now suppose that you have a shell script called saxon which is able to invoke the Saxon processor. Some examples:

$ mkdir html
$ saxon manual.xml html.xsl
$ saxon manual.xml htmlhelp.xsl
$ saxon -o bigmanual.html manual.xml bightml.xsl
$ saxon -o manual.fo manual.xml print.xsl

Use the appropriate command from the examples above to generate the desired output as described above. To get a PDF from the FO file, you must run some FO processor on the manual.fo file.

Note: Generating bigmanual.html with Saxon (using JDK 1.3) takes about two minutes on a Celeron 400 computer. Generating FO files takes about two times more + plus time required to run the FO processor. Generating chunked version or HTML Help version of manual takes about 60 minutes.

Note: Not all customization from DSSSL are ported to XSL, so some things are not as pretty as in DSSSL output currently, but development is underway to migrate the system to use XSL only.