LinuxCommandLibrary

saxon

XSLT and XQuery processor for XML transformation

TLDR

Transform an XML file with an XSLT stylesheet
$ saxon -s:[source.xml] -xsl:[stylesheet.xsl] -o:[output.xml]
copy
Run an XQuery against an XML file
$ saxon -s:[source.xml] -q:[query.xq] -o:[output.xml]
copy
Transform with a parameter
$ saxon -s:[source.xml] -xsl:[stylesheet.xsl] param=[value]
copy
Execute a standalone XQuery file
$ saxon -q:[query.xq]
copy
Run a schema-aware transformation
$ saxon -sa -s:[source.xml] -xsl:[stylesheet.xsl]
copy
Transform with increased memory
$ java -Xmx1024m net.sf.saxon.Transform -s:[source.xml] -xsl:[stylesheet.xsl]
copy

SYNOPSIS

saxon [options] [-s:source] [-xsl:stylesheet] [-q:query] [-o:output] [params]

DESCRIPTION

Saxon is an XSLT and XQuery processor for transforming XML documents. It supports XSLT 3.0, XPath 3.1, and XQuery 3.1, enabling complex document transformations and queries.
The tool processes XML input against XSLT stylesheets or XQuery expressions, producing transformed output. On many systems, wrapper scripts like saxonb-xslt and saxonb-xquery provide convenient command-line access.
Saxon is available in three editions: Saxon-HE (open-source under MPL-2.0), Saxon-PE (professional), and Saxon-EE (enterprise with schema-awareness). It runs on Java, .NET, and JavaScript platforms.

PARAMETERS

-s:file

Source XML document to process
-xsl:file
XSLT stylesheet for transformation
-q:file
XQuery file to execute
-o:file
Output file for results
-sa
Enable schema-aware processing
-t
Display timing information
-explain
Display compiled expression tree
-versionmsg:off
Suppress version message
-xsd:file
Schema document for validation

CAVEATS

Memory for complex transformations is controlled via Java's -Xmx option. Schema-aware features require Saxon-EE. The command syntax varies between Saxon editions and platform wrappers.

HISTORY

Saxon was created by Michael Kay, former editor of the XSLT specification at W3C. Development began in 1998, with Kay founding Saxonica to maintain and commercialize the processor. Since 2023, Saxon is hosted exclusively on the Saxonica website rather than SourceForge.

SEE ALSO

xsltproc(1), xmllint(1), xq(1), java(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard