Installing and Configuring Xalan


The first thing you need to do to install Xalan is to get a Xalan build. You can do this by going to http://xml.apache.org/dist/xalan-j/, which presents you with a list of the current Xalan builds. As of Xalan 2.5.1, there are two binary distributions. Let’s use the Xalan 2.5.1 build as an example. The single jar distribution is named xalan-j_2_5_1-bin.xxx, where xxx is either zip or tar.gz depending on the kind of compressed archive format you need. Typically people on Windows use a .zip file, whereas people on MacOS X, Linux, and UNIX of various sorts use a .tar.gz file. There are also .xxx.sig files, which are detached PGP signatures of the corresponding .xxx file. So, xalan-j_2_5_1-bin.zip.sig contains the signature file for the xalan-j_2_5_1-bin.zip distribution file. You can use PGP and the signature file to verify that the contents of the distribution haven’t been tampered with.

The single-jar distribution is called that because it includes all of Xalan (the interpretive processor and the compiled processor [XSLTC]) in single jar file. The two-jar distribution splits the two processors into separate jars: The interpretive processor is in xalan.jar, and the compiled processor is in xsltc.jar. The two-jar distribution is named xalan-j_2_5_1-bin-2jars.xxx.

If you want the source code for Xalan, you’ll need to get the source code distribution. The source distribution for Xalan 2.5.1 is in xalan-j_2_5_1-src.xxx.

We’ll focus on installing the binary distribution. Once you’ve downloaded a binary distribution, you should unpack it using a zip-file utility or tar and gzip for the .tar.gz files. Doing so creates a directory called xalan-j_2_5_1 in either the current directory or the directory you specified to your archiving utility. The key files in this directory are as follows:

  • Keys—The PGP keys of Xalan committers.

  • License—A text file containing the ASF license.

  • readme.html—The jump-off point for the Xalan documentation. Open it with your Web browser.

  • bin—A directory containing all the jar files for Xalan.

  • docs—A directory containing the Xalan documentation.

  • samples—A directory containing the Xalan sample applications.

You must include an XML parser in your Java classpath in order to use Xalan in your application. The standard Xalan distribution contains a copy of Xerces in the bin directory, in the xml-apis.jar and xercesImpl.jar files. If you choose not to use Xerces as your XML parser, you should be sure that the parser is on the Java classpath. In addition to Xerces, you need the Xalan jars or jars, depending on whether you downloaded the one- or two-jar distribution. This also depends on whether you plan to use only one of the Xalan processors or both of them. If you downloaded the one-jar distribution, make sure xalan.jar (which contains both processors) is on the classpath. If you downloaded the two-jar distribution, make sure the jar files for the processor(s) you plan to use are on the classpath. The interpretive processor is in xalan.jar, and the compiled processor is in xsltc.jar. There are a variety of ways to get the necessary jars onto the classpath, including setting the CLASSPATH environment variable in your DOS Command window or UNIX shell window. You can also set the CLASSPATH for the application server you’re using.

Another installation option is to make Xalan the default XSLT processor for your JDK installation. This only works for JDK 1.3 and above.

JDK 1.3 introduced an Extension Mechanism for the JDK. It works like this. The JDK installation contains a special extensions directory where you can place jar files that contain extensions to Java. If JAVA_HOME is the directory where your JDK has been installed, then the extensions directory is <JAVA_HOME>\jre\lib\ext using Windows file delimiters or <JAVA_HOME>/jre/lib/ext using UNIX file delimiters.

If you’re using JDK 1.4 or above, you need to use the Endorsed Standards Override Mechanism rather than the Extension Mechanism. It works like the Extension Mechanism, but it’s specifically designed to allow incremental updates of packages specified by the Java Community Process (JCP). The major operational difference between the Extension Mechanism and the Endorsed Standards Override Mechanism is that the directory name is different. The Windows directory is named <JAVA_HOME>\jre\lib\endorsed, and the UNIX directory is named <JAVA_HOME>/jre/lib/endorsed.

For JDK 1.2 and above, you should ensure that <JAVA_HOME>/lib/tools.jar is on the CLASSPATH as well.

In JDK 1.4 and above, the default XSLT implementation in JAXP is Xalan 2.2D11. If you want to use a later version of Xalan, the safest thing to do is to copy xml-apis.jar, xercesImpl.jar, and xalan.jar/xsltc.jar into the endorsed standards directory.




Professional XML Development with Apache Tools. Xerces, Xalan, FOP, Cocoon, Axis, Xindice
Professional XML Development with Apache Tools: Xerces, Xalan, FOP, Cocoon, Axis, Xindice (Wrox Professional Guides)
ISBN: 0764543555
EAN: 2147483647
Year: 2003
Pages: 95

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net