Additional serialization parameters
Saxon provides a number of additional serialization parameters, and several additional serialization methods: these have names in the Saxon namespace. These can be specified as attributes on the xsl:output and xsl:result-document elements (XSLT-only), in the Query prolog (XQuery only), as parameters in the fn:serialize() function, or as extra parameters on the Query or Transform command line. They can also be specified in the query or transformation API.
The Saxon-supplied serialization parameters and methods are described on the following pages:
For example, to request an indentation depth of one column, specify
!{http://saxon.sf.net/}indent-spaces=1
on the command line.
In XQuery, Saxon allows both standard serialization options and Saxon-specific serialization
parameters to be specified by means of a saxon:output
option declaration in the
query prolog. For example:
Standard serialization parameters
The standard serialization parameters described in the W3C Serialization specification are all available, namely:
-
allow-duplicate-names (requires XSLT 3.0/XQuery 3.1)
-
build-tree (requires XSLT 3.0/XQuery 3.0)
-
byte-order-mark
-
cdata-section-elements
-
doctype-public
-
doctype-system
-
encoding
-
escape-uri-attributes
-
html-version (requires XSLT 3.0/XQuery 3.0)
-
include-content-type
-
indent
-
item-separator (requires XQuery 3.0)
-
json-node-output-method (requires XSLT 3.0/XQuery 3.1)
-
media-type
-
method
-
normalization-form
-
omit-xml-declaration
-
standalone
-
suppress-indentation (requires XSLT 3.0/XQuery 3.0)
-
undeclare-prefixes
-
use-character-maps (only useful in XSLT)
-
version
Saxon interprets a zero-length value for doctype-system or doctype-public as meaning "absent". This is equivalent to omitting the value, except that in some interfaces it will override a value previously set within the query or stylesheet.
User-defined serialization attributes
Any number of user-defined attributes may be defined on xsl:output
. These
attributes must have names in a non-null namespace, which must not be either the XSLT or the
Saxon namespace. The value of the attribute is inserted into the Properties
object made available to the Receiver
handling the output; they will be ignored by the standard output methods, but
can supply arbitrary information to a user-defined output method. The name of the property
will be the expanded name of the attribute in JAXP format, for example
{http://my-namespace/uri}local-name
, and the value will be the value as given
in the stylesheet.