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 JDK 1.5 (also known as J2SE 5.0) or later. From version 9.2, Saxon will no longer run with JDK 1.4 or earlier releases.

  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-resources9-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 all the necessary files are on your classpath - this is the list of resources available to the Java VM. For details, see Installing (Java).

  5. If you are using Saxon-PE or Saxon-EE, the commercial editions 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, should be placed in the same directory where the file saxon9pe.jar or saxon9ee.jar is found. It is no longer necessary for the directory containing the license file to be on the classpath.

  6. 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 Saxon-HE into c:\saxon, make this your current directory, and type:

for XSLT (all on one line):

java -jar saxon9he.jar -t -s:samples\data\books.xml 
     -xsl:samples\styles\books.xsl -o:c:\temp.html

for XQuery (all on one line):

java -cp saxon9he.jar net.sf.saxon.Query -t 
   -s:samples\data\books.xml -q: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