O'Reilly logo

XSLT by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Installing Xalan

In this section, I’ll show you 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 the .jar file for the Xerces parser, the .jar file for the Xalan stylesheet engine itself, and the .jar file for the Bean Scripting Framework. As of this writing, the .jar files are named xerces.jar, xalan.jar, and bsf.jar.

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 got this error message, you’re all set! You’re ready for the next chapter, in which we’ll build our very first XSLT stylesheet.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required