SAXONB-XSLT(1)

✨ SAXONB-XSLT(1) ✨

okay bestie, welcome to the saxonb-xslt manual page, section 1 of the manual πŸ’… this is the command line XSLT 2.0 processor and she is that girl. let's get into it πŸŽ€


🌸 NAME 🌸

saxonb-xslt β€” command line XSLT 2.0 processor


✨ SYNOPSIS ✨

saxonb-xslt [OPTION...] [-s:SOURCEFILE] [-xsl:STYLESHEET] [-o:OUTPUT]
            [NAME=VALUE...]

πŸ¦‹ DESCRIPTION πŸ¦‹

ngl this page is just a lil quick intro to the saxonb-xslt command. it was written for the Debianβ„’ distribution because the original program does not ship a manual page 😭 instead it has HTML documentation, which lives in the libsaxonb-java-doc package. so like, go read that if you want the full lore.

so what is it? saxonb-xslt is a command line wrapper around the Saxon-B XSLT and XQuery processor. with it you can process XML documents using XSLT 2.0 stylesheets, straight from the command line, no cap. internally, saxonb-xslt is a wrapper around the Java class net.sf.saxon.Transform, which Saxon-B implements. main character energy fr fr πŸ‘‘

you'll usually invoke saxonb-xslt passing the 3 options that are made explicit in the synopsis above. usually those three map to: the input XML file you wanna transform, the XSLT stylesheet describing the transformation you want, and the output file where the result gets saved. periodt. but β€” and this is the plot twist β€” the meaning of those options and whether you even need to pass them depends on a whole bunch of other options you can specify. see the option reference below, bestie, it's all there 🫢

πŸ“ Parameters

at the end of the command line you can drop a list of parameters. they use the syntax NAME=VALUE, so you give the parameter's name and its value together.

a parameter name prefixed with + (plus sign) gets interpreted as a filesystem path parameter. if the path points to a single file, that file gets parsed as XML and its document node becomes the parameter value. if the path points to a directory, every directly contained file gets parsed as XML files, and the sequence of their document nodes becomes the parameter value. cute, right?

a parameter name prefixed with ! (exclamation mark) gets interpreted as an output/serialization parameter. check the XSLT 2.0 and XQuery specs for more on output/serialization parameters, iykyk.

to pass parameters that belong to a non-null namespace, there's a syntax for that: {uri}localname=value.

parameters will be visible as global variables during XSLT processing β€” provided they've been declared with <xsl:param>. and during evaluation, provided they've been declared in the query prolog. see the XSLT spec for more on variables and their declarations πŸ’œ


πŸ’… OPTIONS πŸ’…

here's a summary of everything supported, bestie. options can be passed in any order, so do your thing.

first we list the options that saxonb-xslt and saxonb-xquery share, then the ones specific to saxonb-xslt (or the ones that behave differently here).

some options are flagged as "Saxon-SA only" β€” those only work if Saxon-SA is installed. and heads up: Saxon-SA is a commercial product, so as such it is not available in Debian. πŸ’€

πŸ‘‘ Common options

  • -cr:classname β€” specify a class to use for processing collection URIs passed to the collection() function. the class must implement net.sf.saxon.CollectionURIResolver.
  • -dtd: {[on] | [off]} β€” turn DTD validation on or off. default: off.
  • -expand: {[on] | [off]} β€” when validation is enabled, expand default values in validated documents. this option enables or disables that expansion. default: on.
  • -explain [:filename] β€” display an execution plan; the output is in XML format. if filename isn't given it gets displayed on standard output.
  • -ext: {[on] | [off]} β€” enable or disable the ability to invoke external Java functions from query files and stylesheets. beware: enabling them is a potential security risk when you're processing untrusted files. default: off.
  • -l: {[on] | [off]} β€” keep (when on) or throw away (when off) line numbers in trees corresponding to source documents. when kept, line numbers can be accessed using the function saxon:line-number(). default: off.
  • -outval: {[recover] | [fatal]} β€” when validation is required, set whether validation errors are fatal (when fatal is passed) or whether they only trigger warnings (when recover is). default: fatal.
  • -p: {[on] | [off]} β€” enable or disable usage of the PTreeURIResolver. Saxon-SA only.
  • -r:classname β€” specify a class to use for resolving all URIs.
  • -repeat:N β€” repeat the transformation N times. for benchmarking purposes, bestie.
  • -sa β€” perform Schema-aware processing. Saxon-SA only.
  • -strip: {[all] | [none] | [ignorable]} β€” specify the whitespace stripping policy for source documents: strip all of them (all), strip none of them (none), strip ignorable whitespace only (ignorable). default: none.
  • -t β€” display version, timing, and other debugging information on standard error.
  • -tree: {[tiny] | [linked]} β€” select the implementation of the internal tree model: tiny tree model (tiny) or linked tree model (linked). see the Saxon documentation for more on the internal tree model. default: tiny.
  • -T [:classname] β€” trace various aspects of the processing; you can optionally give a class name to specify a user-chosen tracer. the class must implement net.sf.saxon.trace.TraceListener. the default is a system supplied tracer. this option implies -l.
  • -TJ β€” enable tracing of external Java method invocation. see -ext.
  • -u β€” force interpretation of source document names as URI. by default they're considered to be file names, unless they start with file: or http:.
  • -val: {[strict] | [lax]} β€” when validation is enabled, choose between strict or lax validation. Saxon-SA only.
  • -x:classname β€” specify a class to use as SAX parser for input documents. the class must implement either org.xml.sax.Parser or org.xml.sax.XMLReader.
  • -xi β€” apply XInclude processing to all input documents.
  • -xmlversion: {[1.0] | [1.1]} β€” choose the XML version for processing input documents. you must specify 1.1 to process XML 1.1 and Namespaces 1.1 constructs. default: 1.0.
  • -? β€” display a help message and exit.

🧚 Options specific to saxonb-xslt

  • -a β€” use the "<?xml-stylesheet ... ?>" processing instruction from the source document to find the stylesheet to be used. this option is not compatible with -xsl.
  • -c:filename β€” use the compiled stylesheet stored in filename. this option is not compatible with -xsl.
  • -im:modename β€” use modename as the initial mode used for the transformation. qualified modes can be specified as "{uri}localname".
  • -it:templatename β€” use templatename as the initial named template for the transformation. when this option is used, -xsl is optional.
  • -m:classname β€” specify a class to use as the receiver for messages generated by <xsl:message>. the class must implement net.sf.saxon.event.Receiver.
  • -o:path β€” specify the path to use for saving generated output. usually path points to a filename where the main result document will be saved. if it's not specified, such a document gets written to standard output. additional output documents generated using the <xsl:result-document> command use path as the basename for the "href" attribute of the command. if -o is missing they'll be saved relatively to the current working directory. when -s identifies a directory, -o should identify one too. all the output documents will then be written under that directory.
  • -or:classname β€” specify a class to use as the output resolver for the "href" attribute of <xsl:result-document>. the class must implement net.sf.saxon.OutputURIResolver.
  • -s:path β€” specify the input file or directory. this option is required unless -it has been given. if path points to a filename, that file gets parsed as an XML document and its document node becomes the context item at the beginning of the transformation. the special filename - can be used to require reading the input document from standard input. if path points to a directory, all files directly contained in it get individually transformed. in that case -o is required. -u affects the interpretation of path.
  • -versmsg: {[on] | [off]} β€” enable or disable the warning about using an XSLT 2.0 processor (which Saxon-B is) on stylesheets which specify version="1.0" in their root element. default: on.
  • -warnings: {[silent] | [recover] | [fatal]} β€” set the policy for handling recoverable errors: silent for silent recovery, recover for recovery with warning output on standard error, fatal for no recovery. default: recover.
  • -xsl:filename β€” specify the main XSLT stylesheet to be used for the transformation. this option is required unless -a or -c are specified. the special filename - can be used to require reading the stylesheet from standard input. -u affects the interpretation of filename.
  • -y:filename β€” specify a class to use as SAX parser for stylesheets. the class must implement either org.xml.sax.Parser or org.xml.sax.XMLReader. see also -x.

🌈 SEE ALSO 🌈

saxonb-xquery (1), XSL Transformations (XSLT) Version 2.0 (W3C Recommendation).

this program is fully documented by the HTML documentation of Saxon, available in the libsaxon-java-doc Debian package.


πŸ’– AUTHOR πŸ’–

this manual page was written by Stefano Zacchiroli <zack@debian.org> for the Debianβ„’ system (but it may be used by others, we love sharing 🫢). permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation.

on Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.


Copyright Β© 2008 Stefano Zacchiroli


okay that's the whole page bestie, you ate that πŸ’…βœ¨ this was the saxonb-xslt(1) man page, from February 2008 β€” go forth and transform some XML, you've got this πŸ¦‹πŸ‘‘