Source documents on the command line

When Saxon (either XSLT or XQuery) is invoked from the command line, the primary source will normally be an XML document, and is supplied using the -s option (for example, -s:books.xml). Normally this will be XML 1.0: for XML 1.1, see XML 1.1.

If the primary source is JSON, use the -json option (for example, -json:books.json).

The command line argument is assumed to be a filename (interpreted relative to the current directory) unless (a) it starts with file:, http:, or https:, or (b) the -u option is supplied. If either of these conditions is true, it is interpreted as a URI, and is handled as described in Resolving URIs. The current working directory is used as the base URI for resolving the location of the stylesheet or query unless otherwise specified: this affects the interpretation of relative URIs contained within the stylesheet or query.

If a custom parser is specified using the -x option on the command line, then the source document can be in any format accepted by this custom parser. The parser must behave as a SAX2 parser, delivering a stream of events that define a virtual XML document. For example, the TagSoup parser can be used to feed an HTML document as input to Saxon.