Download the latest distribution of Saxon from http://saxon.sourceforge.net/ and unzip the zip to a suitable location.
Append /directory/you/unzipped/saxon/saxon.jar to the CLASSPATH environment variable. If integration with FOP is desired, append /directory/you/unzipped/saxon/saxon-fop.jar to the CLASSPATH environment variable. If integration with JDOM is desired, append /path/to/where/you/unzipped/saxon/saxon-jdom.jar to the CLASSPATH environment variable.
A catalog resolver provides a way to use catalog files with Java tools like Saxon, the details of this can be found in the documentation that comes with the installation download.
Download the XML Entity and URI Resolvers package from http://wwws.sun.com/software/xml/developers/resolver/. You have to register to download.
Unzip the package to some suitable location, add the file resolver.jar to your CLASSPATH environment variable.
Append the directory where the resolver tool was unzipped to the CLASSPATH environment variable.
The Resolver is now ready to use with Saxon but by default it uses the AElfred XML parser that comes with Saxon. This has a few problems so it is best to invoke Saxon and specify that xerces should be used instead. Note that this requires that xerces be installed, usually this consists of having the file xerces.jar in the CLASSPATH. It is likely that if other tools such as FOP have been installed that this is already the case, if it is not, download and install xerces from http://xml.apache.org/xerces-j/.
One invokes Saxon and specifies that xerces should be used as the XML parser like this:
java -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
-Djavax.xml.transform.TransformerFactory=com.icl.saxon.TransformerFactoryImpl
com.icl.saxon.StyleSheet
|
This must all be input on one line, this is where Ant (http://jakarta.apache.org/ant/) comes in very useful. The resolver uses a file called CatalogManager.properties to specify various options, this must be present somewhere on the CLASSPATH. By default this file resides in the root directory of the resolver zip extraction, hence the adding of this directory to the CLASSPATH in step three of the installtion above. Details on setting up CatalogManager.properties can be found in the documentation that comes in the downloaded archive. A simple example is shown below:
#CatalogManager.properties
verbosity=1
# Always use semicolons in this list
catalogs=/lib/docbook-xml-4.2/catalog
# Prefer PUBLIC identifiers over SYSTEM identifiers
prefer=public
|
This sets up the resolver to use the catalog file specified.