Serialization
When 4.0 processing is enabled, the new serialization option
json-lines="yes" is implemented. (PR 1497,
PR 1596)
The JSON serializer recognises the xs:QName value fn:null
as a representation of the JSON null value. (PR 1028) Since QName literals are supported, this can
be generated using, for example, <xsl:sequence select="#fn:null"/>.
The adaptive output method now does (fairly crude) indentation of maps and arrays
if the indent serialization option is set. Previously maps and arrays
were output without indentation.
The adaptive serialization method has changed to output maps as {...}
rather than map{...}.
A new Saxon serialization property is introduced: saxon:conditional-cdata.
If set to true, text is output within a CDATA section only when (a) the containing element
is named in the cdata-section-elements property, and (b) the text contains
at least one special character, specifically a less-than or ampersand character.
The serialization parameter saxon:stylesheet-version (which in previous releases was largely
for internal use) is now renamed saxon:spec-version, and can be used to control which version
of the serialization specification is to be used. The differences are minor, but with version 4.0, for example,
JSON output adopts a fallback representation of Infinity and NaN rather than rejecting these values with an
error. When the serializer is invoked directly from XQuery or XSLT then this serialization parameter
is set automatically based on the XQuery or XSLT version, but when serialization is invoked
directly by a user application, it can be set manually.
When generating HTML5 output including a meta element, the meta
element now uses the form mandated by the HTML5 living standard (with a charset
attribute). This applies even when 4.0 processing is not activated.
Technically this is a non-conformance with the XSLT 3.0 / XQuery 3.1 specifications,
but compliance with HTML5 clearly takes precedence here.
When 4.0 is enabled, the option canonical="yes" can be used to produce
canonical XML.