Installing Xalan

In this section, we’ll go over how to install the Xalan XSLT processor. In the next chapter, we’ll create our first stylesheet and use it to transform an XML document.

The installation process is pretty simple, assuming you already have a Java Runtime Environment (JRE) installed on your machine. Although very little of the code we look at in this book uses Java, the Xalan XSLT processor itself is written in Java. Once you’ve installed the JRE, go to http://xml.apache.org/xalan-j/ and download the latest stable build of the code. (If you’re feeling brave, feel free to download last night’s build instead.)

Once the Xalan .zip or .gzip file is downloaded, unpack it and add three files to your CLASSPATH. The three files include two .jar files for the Xerces parser, and the .jar file for the Xalan stylesheet engine itself. As of this writing, the .jar files are named xalan.jar, xercesImpl.jar, and xml-apis.jar. (There’s a fourth file, bsf.jar, that includes the Bean Scripting Framework, but we’ll use that for extensions only.)

To make sure Xalan is installed correctly, go to a command prompt and type the following command:

java org.apache.xalan.xslt.Process

This is a Java class, so everything is case-sensitive. You should see an error message like this:

java org.apache.xalan.xslt.Process
=xslproc options:
    -IN inputXMLURL
   [-XSL XSLTransformationURL]
   [-OUT outputURL]
   [-LXCIN compiledStylesheetFileNameIn]
   [-LXCOUT compiledStylesheetFileNameOutOut]
...

If you get this message, ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.