Serialization

The serialization property saxon:attribute-order has been extended so that it may now include the token "*" to match unspecified attributes; this allows selected attributes to be forced to the end of the list. For example saxon:attribute-order="a b c * xml:space" will cause attributes to be output in the order a, then b, then c, then everything else (sorted by URI and local name), then xml:space. Further details at Serialization parameters.

The algorithm for indenting XML has been improved so that existing whitespace appearing in a position where indenting takes place (before a start tag or after an end tag) is replaced by the new whitespace, rather than being retained.

The serialization property suppress-indentation is now implemented for the HTML and XHTML output methods.

A new serialization property saxon:property-order controls the order of properties within a serialized map when using the JSON output method. It follows the same principles as saxon:attribute-order. In this case the value is a space-separated list of tokens, with "*" treated specially. Further details at Serialization parameters.

With indented JSON output, the output is now more compact:

  1. The saxon:indent-spaces property now controls the amount of indentation (default is two spaces).
  2. The serializer avoids outputting a new line before or after a map or array containing less than two entries.
  3. The serializer output arrays and objects on a single line if none of the entries is an array or map, and the total size of the entries is less than L, where L is the value of saxon:line-length if present, or 80 if not specified.

In JSON serialized output, integers (specifically, xs:integer values, and any other numeric values that are equal to a whole number and have absolute value less than 10^18) are now output as integers; exponential notation is no longer used in such cases.

A new serialization property saxon:canonical is available (values yes or no). Used with the output method XML, the value yes requests output conforming to the W3C XML Canonicalization 1.1 specification (C14N). This can be useful when comparing test results, or when documents need to be digitally signed.

The restrictions on the use of disable-output-escaping in conjunction with xsl:try and xsl:fork have been lifted. These instructions need to buffer their output, rather than writing it straight to the serializer; the buffer is now held in the form of a list of push events, which allows the disable-output-escaping property to be retained along with the event.