Transforming XML files with XSLT 2.0 and Saxon-HE on OS X, using an XML catalog

·

Saxon-HE - put saxon9he.jar in /Library/Java/Extensions.

Apache XML Commons Resolver (download) - put resolver.jar in /Library/Java/Extensions.

java \
-Dxml.catalog.files=/etc/xml/catalog \
net.sf.saxon.Transform \
-x org.apache.xml.resolver.tools.ResolvingXMLReader \
-y org.apache.xml.resolver.tools.ResolvingXMLReader \
-r org.apache.xml.resolver.tools.CatalogResolver \
-o $OUTPUT_FILE.xml \
$INPUT_FILE.xml \
$XSL_FILE.xsl

Saxon-HE is a noncommercial version of the Saxon XSLT processor. The main (perhaps only) reason for using it instead of libxslt/xsltproc is that it implements XSLT 2.0.