Skip to content

Installation on Mac and Linux

Sandro Cirulli edited this page Feb 20, 2016 · 9 revisions

Requirements

XSpec requires the Saxon XSLT and XQuery processor which can be downloaded from:

For this installation the Saxon JAR (e.g. saxon9he.jar) is assumed to be in ~/xspec.

Mac/Linux Installation

  1. Clone the master branch of XSpec from GitHub:

    git clone https://github.com/expath/xspec.git

    For this installation both XSpec and Saxon are assumed to be in ~/xspec.

  2. Set up the Saxon environment variables. You can either set $SAXON_HOME to the location of the Saxon jar file:

    export SAXON_HOME=~/xspec/

    or alternatively set $SAXON_CP to the full classpath containing the Saxon jar file:

    export SAXON_CP=/path/to/saxon/saxon9he.jar

    You can check that the environment variable is set with:

    echo $SAXON_HOME

    SAXON_CP has precedence over SAXON_HOME.

    If you want to make the change permanent, set the environment variable in your shell profile (e.g. ~/.bashrc or ~/.bash_profile).

  3. Open up a terminal, navigate to ~/xspec, make sure that the file bin/xspec.sh is executable, and test the shell script with this command:

    bin/xspec.sh -h

    The output should be the following usage summary:

    Saxon script not found, invoking JVM directly instead.
    
    Usage: xspec [-t|-q|-c|-h] filename [coverage]
    
      filename   the XSpec document
      -t         test an XSLT stylesheet (the default)
      -q         test an XQuery module (mutually exclusive with -t)
      -c         output test coverage report
      -h         display this help message
      coverage   deprecated, use -c instead
    

Congratulations! You have successfully installed XSpec!

To make the XSpec script more portable and invoke it from anywhere, set the environment variable $XSPEC_HOME to the location where XSpec is stored and add a script invoking xspec.sh in /usr/bin.