Contents
A system Saxon JAR is used with scripting via a Bash executable
Please use the same version of Saxon used by Oxygen as noted in server documentation tracking versions of Saxon used across servers: https://github.com/CDRH/cdrh-technical-documentation/blob/main/pages/Saxon.md#versions
# Make directory named for the version:
sudo mkdir /usr/local/share/saxon-(version)
# Symlink to versioned directory for quick switching in the future
sudo ln -s /usr/local/share/saxon-(version) /usr/local/share/saxon
Copy the Saxon JAR file (e.g. saxon9he.jar
) from another server with scp
or rsync
or
Download Saxon-HE from Saxonica Open Source
Find saxon9he.jar and move it to usr/local/share/saxon-(version) (make sure to have the Finder show hidden files, if you are on a Mac).
This bash executable passes its arguments through to and runs the Saxon JAR
sudo vim /usr/local/bin/saxon
:
#!/usr/bin/env bash
JAVA_BIN="$(which java)"
SAXON_JAR="/usr/local/share/saxon/saxon9he.jar"
# If JAVA_HOME is defined, call java from ENV-based path
if [[ -n "${JAVA_HOME}" ]]; then
JAVA_BIN="${JAVA_HOME}/bin/java"
fi
# Pass all bash arguments ($@) through to the Saxon JAR
exec "${JAVA_BIN}" -jar "${SAXON_JAR}" "$@"
# Exit with an error status if the exec shell exits back to this script
exit 1
Add the executable permission to the Bash script:
sudo chmod +x /usr/local/bin/saxon
If you locate your Saxon JAR somewhere other than /usr/local/share/saxon/saxon9he.jar
, make sure to update the path stored in the SAXON_JAR
variable at the top of the script.
Now you and others may run saxon (arguments)
from anywhere on your system to save typing and run Saxon within scripts.
If you get an error about locating a Java Runtime, this is probably because macOS no longer comes installed with a Java Runtime Environment. Run brew install java
.
- Download / Support Info: http://saxonica.com/download/opensource.xml
- Release Announcements: https://saxonica.plan.io/news/1
- Bug Fixes: In release(version #).txt file on SourceForge
- Change Info: http://www.saxonica.com/documentation/#!changes/serialization/9.2-9.3
- Issues: https://saxonica.plan.io/projects/saxon/issues