Table of Contents
This chapter gives standard intall procedure examples for the most usual translators: XT, Xalan, xsltproc and Saxon. Besides, it tries to list the particularities in using each of them.
XT is a translator that seems a bit lighter than Xalan. However some features are missing. Anyway, HTML transformation works without problem provided that the N. Walsh XSL stylesheets used are compliant to this tool. Here is an install procedure example:
Download the XT distribution.
Download an XML parser that supports SAX, let's say XP.
% mkdir /usr/local/xt /usr/local/xp % unzip xt.zip -d /usr/local/xt % unzip xp.zip -d /usr/local/xp
Put the XT libraries (xt.jar and sax.jar) and the XP library (xp.jar) in your CLASSPATH:
% CLASSPATH=$CLASSPATH:/usr/local/xt/xt.jar:/usr/local/xt/sax.jar % CLASSPATH=$CLASSPATH:/usr/local/xp/xp.jar % export CLASSPATH
Xalan Java 1.x should not be used anymore, since the current XSL stylesheets cannot work with these versions anymore. I suggest to use Xalan Java 2.0.1, that works fine on my machine.
Download the package from the Xalan page. You don't need to download an XML parser since Xalan provides the Xerces java archive.
% cd /usr/local/xslt/ % tar xvzf xalan-j_2_*_*.tar.gz
Put the Xalan java archives in your CLASSPATH:
% CLASSPATH=$CLASSPATH:/usr/local/xslt/xalan-j_2_*_*/bin/xalan.jar % CLASSPATH=$CLASSPATH:/usr/local/xslt/xalan-j_2_*_*/bin/xerces.jar % export CLASSPATH
Some extensions are sometimes required by the stylesheets (e.g, for tables). Add the DocBook XSL Xalan2 extension archive in your CLASSPATH:
% CLASSPATH=$CLASSPATH:/(path)/docbook/extensions/xalan2.jar
Absolute paths for XSL stylesheets must be prefixed by file://. For instance, using the HTML stylesheet with Xalan looks like:
java org.apache.xalan.xslt.Process -in mydoc.xml -xsl file:///path/to/docbook/html/docbook.xsl
xsltproc is the XSLT program example provided with the libxslt library from Gnome. The libxslt/libxml2 libraries development is a Gnome project, written entirely in C (not in C++ nor in Java). This default XSLT is good enough to publish the XML documents, but one can always create its own program linked to the Gnome libraries. The big advantage of these libraries are:
Here is an install procedure example, for those installing the packages from the gzipped sources:
Download the libxml2 library from the XML page.
% tar xvfz libxml2-<version>.tar.gz
Configure and build the binaries:
% cd libxml2-<version> % ./configure % make
% make install
Download the libxslt library from the XSLT page.
% tar xvfz libxslt-<version>.tar.gz
Configure and build the binaries:
% cd libxslt-<version> % ./configure % make
% make install
Once done, xsltproc is available, and the libxml2/libxslt libaries are installed.
Libxml2 supports catalog resolution, and thus xsltproc supports this feature too. To use you just need to:
Define a catalog that gives the XML DocBook DTD path. For example the catalog would look like this:
-- Catalog to find the DTD DocBook XML file-- PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "file:///path/to/docbook/docbkx412/docbookx.dtd"
Add this catalog location in the SGML_CATALOG_FILES variable:
export SGML_CATALOG_FILES=$SGML_CATALOG_FILES:/path/of/the/catalog