Trademark Logo Xalan XSL Transformer User's Guide
Download/Build & Dependencies
Apache Foundation Xalan Project Xerces Project Web Consortium Oasis Open

Download/Build & Dependencies

(top)

Downloading the latest release

You can download the pre-built binary distributions from one of the mirror sites at xalan-j distribution directory.

Xalan-J has two processors, an interpretive one, Xalan Interpretive, and a compiled one, Xalan Compiled (XSLTC). Your choice of which binary distribution to download depends on which of the processors you want to use. There are 2 binary distributions available; you only need to choose one of them. Both binary distributions contain xml-apis.jar and xercesImpl.jar from Xerces-Java 2.11.0.

We provide two distributions: a binary distribution, and a source distribution. You can also download a source distribution from one of the same mirror sites at xalan-j distribution directory. The difference is that a binary distribution contains -bin in its name, whereas a source distribution contain -src in its name.

To use Xalan-Java, you need the following which are available from either a binary or source distribution:

If you have downloaded a binary distribution, you already have a build (you have the jars). This is also true for a source distribution, however if you downloaded a source distribution, you have the option to use Ant to build Xalan-Java, including xalan.jar, xsltc.jar, serializer.jar and other things, see Using Ant for more details.

(top)

Downloading what else you might need

To use Xalan-Java, you need the following:

You can get the JDK or JRE from IBM developerWorks or java.sun.com.

If you plan to run XSLT extensions through extension functions or elements, and you want to implement that support in languages other than Java, then you will need an implementation of the Bean Scripting Framework (BSF). An open source implementation is available for download from Apache. See the Apache Jakarta BSF project. If you plan to run XSLT extensions implemented in scripting languages, you will need bsf.jar and one or more additional files as indicated in extensions language requirements.

(top)

Where do I get Xerces-Java?

The Xalan-Java Version 2.7.2 has been tested with Xerces-Java 2.11.0.

Important: You may experience unpredictable anomalies if your Xalan-Java and Xerces-Java builds are not in synch. If you download an update to Xalan-Java, check the release notes to determine which version of Xerces-Java you should use.

note You can use Xalan-Java with other XML parsers that implement the Java API for XML Processing (JAXP) 1.3. See Plugging in the Transformer and XML parser.

The Xalan-Java download includes xercesImpl.jar from Xerces-Java 2.11.0. In conjunction with xml-apis.jar, this is all you need to run Xalan-Java with the Xerces-Java XML parser. You can, however, download the complete Xerces-Java binary or source distribution from the xerces-j distribution directory. If you cannot find Xerces-Java 2.11.0 at that location, have a look at the Apache archive location for Xerces Java.

note If you plan to use a different XML parser, see Plugging in a Transformer and XML parser.

(top)

How do I view Xalan code in a browser?

If you wish to view some of Xalan's files in a browser without downloading the whole project you can view it at http://svn.apache.org/viewvc/xalan/ or at http://svn.apache.org/repos/asf/xalan/. The link with "viewvc" in it is slightly prettier.

The java/trunk and test/trunk subdirectories are the ones with the latest development code.

(top)

How do I download the latest development code to build myself?

If you have downloaded a source distribution, or obtained source code using subversion, this section may be of interest to you.

If you wish to download Xalan and build it yourself, perhaps because you want to apply a patch and test it, you will need a subversion client and anonymous access to the repository. Don't worry, everyone has anonymous access. You can find pre-built binaries of subversion clients for different operating systems here: http://subversion.tigris.org/project_packages.html#binary-packages. See http://www.apache.org/dev/version-control.html for more information on Apache and subversion.

Once the subverion client is installed on your local machine you can use the command line client program svn to get the latest Xalan-J using a command line something like this:

    svn checkout http://svn.apache.org/repos/asf/xalan/java/trunk java    
    
where the argument after checkout is the Subversion repository location, in this case the location of the latest development code, and the last argument, in this case java is the location of the local directory that the repository is copied to.

Similarly for the test harness, you can download the latest test harness with a Subversion command something like this:

    svn checkout http://svn.apache.org/repos/asf/xalan/test/trunk test    
    

Those two commands will put a copy of the latest parts in the local directories java and test, which are sibling directories. If you want to test your build with the test harness provided with Xalan then it is easiest if you keep the local directory names as suggested. With your paths set up to compile Java code, go into the local java directory and issue these two commands:

  build clean
  build  
  

The build.bat batch file, or build.sh shell script (depending on your operating system use ant and the buildfile build.xml. See the section Using ant for more information.

Other useful targets may be xsltc.jar or serializer.jar. If you want to test the jars you just built in the directory java/build, change to directory test and issue this command:

  build jar
  build smoketest
    
The first target, jar builds the test harness and only needs to be done once after the test repository is checked out. The second target, smoketest, runs the Xalan-J intepretive smoketest. Running the build smoketest or other targets in the test directory automatically looks for the jars in the directory ../java/build and that is why it is easiest to download the projects into suggested sibling directories with the given names.

Towards the end of the console output you will see two CONGRATULATIONS! messages if all goes well. The end of the console output should look like this:

    .
    .
    .
minitest-pass:
     [echo]  [minitest] CONGRATULATIONS! The Minitest passed!
     [echo]  [minitest] See details in smoketest/Minitest.xml

smoketest-notpass:

smoketest-pass:
     [echo]  [minitest] CONGRATULATIONS! The Smoketest passed!
     [echo]  [minitest] Details are in smoketest/results-conf.xml, smoketest/results-api.xml, smoketest/extensions/results-extensions.xml

smoketest:

BUILD SUCCESSFUL
Total time: 2 minutes 4 seconds
build completed! 
    

Don't be fooled by the BUILD SUCCESSFUL messages, look for the two CONGRATULATIONS! messages. If you run the smoketest for XSLTC with build smoketest.xsltc you wil only get one CONGRATULATIONS! message if all goes well.

(top)

Using Ant To Build

If you have downloaded a source distribution, or obtained source code using subversion, this section may be of interest to you.

Apache Ant is a flexible, powerful, and easy-to-use Java build tool that we include with the Xalan-Java distribution. The Ant JAR file is in the tools directory, and the cross-platform XML build file (build.xml) is in the root directory along with a Windows32 batch file (build.bat) and a UNIX shell file (build.sh). The build file defines the "targets" that you can use Ant to build. The batch and shell files set up the classpath and launch Ant with the target (and any other arguments) you provide.

Instructions for using Ant

  1. Set the JAVA_HOME environment variable to the JDK root directory.

    JDK 1.3.1 or higher is required to build Xalan-Java. You must put tools.jar from the JDK bin directory on the classpath.

  2. Depending on your environment, run the batch file (build.bat) or shell file (build.sh) from the Xalan-Java root directory, optionally with arguments (see the table of targets below).

    The batch/shell file adds several JAR files to the classpath and launches Ant with any arguments you provide. If you provide no target, Ant compiles the source files and rebuilds xalan.jar (the "jar" target).

The Xalan-Java source code tree is in the src directory.

If you are using Ant, the target is jar (the default).

You can also set up your classpath manually (see build.bat or build.sh for the details), and then run Ant as follows:

java org.apache.tools.ant.Main target

where target is nothing (for the default target) or one of the following.

Ant Target What Ant does
compile compiles Xalan-Java in build/classes.
jar (the default) creates xalan.jar and serializer.jar in the build directory
serializer.jar creates serializer.jar in the build directory
xsltc.jar creates xsltc.jar in the build directory
samples compiles and jars the sample apps in build/xalansamples.jar
servlet compiles and jars the sample servlet in build/xalanservlet.jar
docs creates the HTML User's Guide in build/docs
javadocs generates the API documentation in ./build/docs/apidocs
fulldist generates a complete distribution tree with zip and tar.gz distribution files in build
clean purges the build and distribution

If you build a target that depends on other targets, Ant creates those other targets in the correct order.

Building without Ant

If you want to do the build without Ant, keep the following in mind:

(top)

Rebuilding a sample application

If you modify a sample and want to recompile it, you can run the Java compiler in the directory containing the example. Be sure xalan.jar, serializer.jar, xml-apis.jar, and xercesImpl.jar are on the classpath.

To recompile and run the class files in the servlet subdirectory, the javax.servlet and javax.servlet.http packages must also be on the classpath. These packages are available via the servlet.jar file found in Apache Tomcat ( see The Jakarta Site - Apache Tomcat ).

After recompiling a sample, you can use the jar utility to place your new .class files in xalansamples.jar.

You can use Ant with the samples target to recompile the samples and place the unpackaged class files in xalansamples.jar. For more information, see Using Ant.

note To rebuild (and to run) the sample servlet, the javax.servlet and javax.servlet.http packages must be on your classpath.

(top)

Where do I download previous releases?

To access previous releases, see the xalan-j archive directory.

(top)