Saxonica.com

Getting started with Saxon on the Java platform

  1. Download the software (you will typically start with the open-source version) from SourceForge. It will run on any machine that supports Java.

  2. The software comes as a zip file. Unzip it into a suitable directory, for example c:\saxon.

  3. As a first-time user, you will probably want to install the sample applications. These are packaged together with a copy of this documentation and Saxon-B source code in the file saxon-resources8-n.zip. This can be downloaded from either the SourceForge or Saxonica sites. (It is the same file in both cases). Unzip the contents of this file into the same directory.

  4. Make sure that a suitable Java JDK is installed on your machine. Saxon requires Java JDK 1.4 or later. If you have a choice, it is best to use JDK 1.5 (also known as J2SE 5.0), since that includes the latest version of JAXP as standard, giving less scope for configuration problems. If necessary, download and install J2SE 5.0 from http://java.sun.com/javase/downloads/index.jsp

  5. Make sure that all the necessary files are on your classpath - this is the list of resources available to the Java VM. For details, see Installing (Java).

  6. If you are using Saxon-SA, the commercial schema-aware version of Saxon, you will need to obtain a file containing a licence key. You can apply for a free 30-day license key by going to www.saxonica.com and clicking on "Evaluation Copy". The license key file will be sent by email within 24 hours. This file, called saxon-license.lic, must be placed in a directory that is listed on the Java classpath. Note that it is the directory that must be on the classpath, not the saxon-license.lic file itself.

  7. Saxon doesn't come with a graphical user interface: it's designed to be integrated into other tools and applications. You will therefore start by using it from the operating system command line. On Windows, you may want to install a text editor such as jEdit that offers a more friendly command line than the standard DOS console provided by Microsoft. However, if you're not comfortable running applications from the command line, you might like to try the open-source Kernow product from Andrew Welch.

You can now run one of the sample stylesheets or queries that comes with in the saxon-resources download. Assuming you installed into c:\saxon, make this your current directory, and type:

for XSLT (all on one line):

java -jar saxon8.jar -t samples\data\books.xml 
     samples\styles\books.xsl >c:\temp.html

for XQuery (all on one line):

java -cp saxon8.jar net.sf.saxon.Query -t -s 
     samples\data\books.xml samples\query\books-to-html.xq >c:\temp.html

Now open c:\temp.html in your browser to check that it worked.

For more details on installing Saxon on the Java platform, see Installing (Java)

Next