Getting started with Saxon on the .NET platform

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 UltraEdit that offers a more friendly command line than the standard DOS console provided by Microsoft.

  1. It is highly recommended that you have .NET version 4.0 or higher installed on your machine. This is available as a free download from Microsoft. (Saxon may work with older versions of .NET, but this has not been thoroughly tested.) For non-Windows users, the .NET Saxon product can also be run on the Mono platform.

  2. Download the software (you will typically start with the open-source version Saxon-HE) from SourceForge. Alternatively, the commercial editions of the product (Saxon-PE and Saxon-EE) can be downloaded from www.saxonica.com.

  3. The software comes as a .exe installer: SaxonHEn-n-n-nNsetup.exe for Saxon Home Edition, SaxonPEn-n-n-nNsetup.exe for the Professional Edition, and SaxonEEn-n-n-nNsetup.exe for the Enterprise Edition. Double-click it to run the installer. It installs the executable files into a user-selected directory, sets a registry entry to point to this location, and registers the relevant DLLs in the Global Assembly Cache.

  4. As a first-time user, you will probably want to install the sample applications. These are packaged together with a copy of this documentation 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 as the Saxon software.

  5. If you are using a commercial edition of Saxon (that is, Saxon-PE or Saxon-EE), you will need to obtain a file containing a licence key. The license key is interchangeable between the Java and .NET platforms. You can apply for a free 30-day evaluation license key by going to www.saxonica.com and clicking on "Try Saxon for 30 days". The license key file will be sent by email within 24 hours. This file, called saxon-license.lic, should be placed in the directory containing the Saxon DLL files: for example c:/Program Files/Saxonica/SaxonPE9.8N/bin. When running Saxon from the command line, it is no longer necessary for the directory containing the license file to be on the classpath. For more details on Saxon license keys, see the Saxon Licenses section.

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

for XSLT (all on one line):

bin\Transform -t -s:samples\data\books.xml -xsl:samples\styles\books.xsl -o:c:\temp.html

for XQuery (all on one line):

bin\Query -t -s:samples\data\books.xml -q:samples\query\books-to-html.xq -o:c:\temp.html

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

For more complete details on installing Saxon on the .NET platform, see Installing (.NET)