XSLT 3.0 conformance
Saxon offers a very high level of conformance to the XSLT 3.0 specifications. Known exceptions are listed in this section.
Test results
SaxonJ 11.1 passes all 11714 applicable tests from the XSLT 3.0 test suite.
SaxonCS 11.1 passes all 11475 applicable tests from the XSLT 3.0 test suite. (The totals are different because some tests are applicable to one product but not the other, for example because they have dependencies on optional settings such as localization.)
These figures exclude tests that were specifically omitted because they cannot be run, even where this represents
a non-conformance. For example, the Microsoft System.Xml
parser does not report DTD-based attribute types
to the application, which means that some of the tests for the id()
function cannot succeed.
Although the W3C XSLT Working Group has ceased operation, the W3C test suite continues to be developed by volunteers, and Saxonica remains an active contributor. Conformance issues raised by Saxon users typically result in new test cases being added to the test suite.
Conformance overview
Broadly speaking:
-
Saxon-HE implements the following features of the XSLT 3.0 specification:
- Basic Conformance
- Serialization
- XPath 3.1
- Compatibility (that is, XSLT 1.0 compatibility mode)
- Dynamic Evaluation (the
xsl:evaluate
instruction) - Higher-Order Functions
Saxon-HE includes support for the language features associated with XSLT 3.0 packages, but with limited operational support. Specifically, Saxon-HE allows compiled stylesheet packages to be loaded from filestore, but creating such packages requires Saxon-EE.
-
Saxon-PE provides a range of Saxon-specific extensions, and allows users to implement their own extensions, for example by calling out to user-defined functions.
Where possible, extensions are implemented in a Saxon-specific namespace as required by the W3C standard. Some experimental syntax extensions, which have been proposed for future standardization, are available if explicitly enabled using a configuration switch.
-
Saxon-EE adds support for two further optional features of the XSLT 3.0 specification, specifically:
- Schema-Awareness
- Streaming
Saxon-EE also provides many more operational options not specifically tied to language features, for example the ability to export packages in compiled form, and multi-threaded execution.
SaxonCS corresponds to Saxon-EE on Java.
For information on streaming, see Streaming XML documents.
For information on using packages, see Compiling a stylesheet.
Non-conformances
The following non-conformances are known:
In SaxonCS, there are limitations imposed by use of the Microsoft
System.Xml
parser: for details see XML parsing in SaxonCS.The W3C specification requires that vendor-defined extensions must only change the processor's behavior to the extent that the specification leaves the behavior implementation-defined. Some Saxon-defined extensions do not follow this rule: they explicitly change the behavior to make it non-conformant.
For example:
- Calling
saxon:discard-document()
means that a subsequent call onfn:doc()
with the same URI will not return the same document node. - The extension attribute
xsl:map/@saxon:on-duplicates
defines non-conformant ways of handling duplicate entries in a constructed map. - The serialization attribute
xsl:output/@saxon:canonical
causes Saxon to produce output conforming with the W3C canonicalization specification, even where this conflicts with the XSLT-defined serialization rules (for example, empty elements are output as<hr></hr>
).
- Calling
The XSLT 3.0 specification requires a processor to offer a mode of processing in which XPath 3.1 constructs such as array constructors (which are not part of XPath 3.0) are rejected. Saxon does not have such a processing mode: all XPath 3.1 constructs are accepted unconditionally.
A small number of constructs that should be streamable according to the XSLT 3.0 specification are not streamable in Saxon; and vice versa.
Checklist of implementation-defined items
The following list describes the way in which Saxon implements the features that the specification leaves implementation-defined. The numbering of items in the list corresponds to the numbering in the checklist provided as Appendix F of the XSLT 3.0 specification.
The implementation-defined features are grouped into categories for convenience.
F.1 Application Programming Interfaces
This category covers interfaces for initiating a transformation, setting its parameters, initializing the static and dynamic context, and collecting the results. In general terms, it is implementation defined how input is passed to the processor and how it returns its output. This includes the interpretation of URIs used to refer to stylesheet packages and modules, source documents and collections, collations, and result documents.
► For information on Saxon's APIs for XSLT transformation, see Invoking XSLT from an application.
More specifically:
-
A processor MAY also provide a mode of operation in which static errors in parts of the stylesheet that are not evaluated can go unreported. (See 2.14 Error Handling)
► By default, in Saxon-EE, the body of a template rule is compiled only the first time that the template rule is evaluated; static errors in unused template rules are therefore not detected. This setting can be changed for example by using
-opt:-j
on the command line. -
If the initialization of any global variables or parameter depends on the context item, a dynamic error can occur if the context item is absent. It is implementation-defined whether this error occurs during priming of the stylesheet or subsequently when the variable is referenced; and it is implementation-defined whether the error occurs at all if the variable or parameter is never referenced. (See 2.3.2 Priming a Stylesheet)
► The error typically only occurs when the variable is actually referenced.
-
The way in which an XSLT processor is invoked, and the way in which values are supplied for the source document, starting node, stylesheet parameters, and base output URI, are implementation-defined. (See 2.3.2 Priming a Stylesheet)
► For information on Saxon's APIs for XSLT transformation, see Invoking XSLT from an application. Transformations can also be invoked from the command line (see XSLT from the command line).
-
The way in which a base output URI is established is implementation-defined. (See 2.3.6 Post-processing the Raw Result)
► For the
s9api
interface:XsltTransformer30.setBaseOutputURI()
. For the command line: the-o
option. -
It is implementation-defined how a package is located given its name and version, and which version of a package is chosen if several are available. (See 3.5.2 Dependencies between Packages)
► Packages can be explicitly loaded into a configuration, for example by use of the
-pack
option on the command line or by the methodXsltCompiler.importPackage()
.► It is also possible to list the available packages in a configuration file, with their versions, and to indicate which of several versions is preferred if the using package indicates no preference.
-
In the absence of an
[xsl:]default-collation
attribute, the default collation may be set by the calling application in an implementation-defined way. (See 3.7.1 The default-collation Attribute)► The name of the default collation may be specified as a configuration option on the XSLT compiler:
XsltCompiler.declareDefaultCollation()
. -
It is implementation-defined what forms of URI reference are acceptable in the
href
attribute of thexsl:include
andxsl:import
elements, for example, the URI schemes that may be used, the forms of fragment identifier that may be used, and the media types that are supported. The way in which the URI reference is used to locate a representation of a stylesheet module, and the way in which the stylesheet module is constructed from that representation, are also implementation-defined. (See 3.11.1 Locating Stylesheet Modules)► A user-written
URIResolver
may be supplied to handle any kind of URI that the application wishes to handle. -
The statically known documents, statically known collections, and the statically known default collection type are implementation-defined. (See 5.3.1 Initializing the Static Context)
► These values are all empty; no documents, collections, or collection types are known statically.
-
Implementations may provide user options that relax the requirement for the
doc
andcollection
functions (and therefore, by implication, thedocument
function) to return stable results. The manner in which such user options are provided, if at all, is implementation-defined. (See 5.3.3 Initializing the Dynamic Context)► Document stability may be relaxed by calling the extension function
saxon:discard-document()
. Collection stability can be controlled at the configuration level, or at the level of an individual collection by means of a query parameter in the collection URI. -
The implicit timezone for a transformation is implementation-defined. (See 5.3.3.2 Other Components of the XPath Dynamic Context)
► The value is taken from the system clock, as exposed by the Java platform. Alternatively, the current date and time may be set programmatically, and the implicit timezone is taken from this value.
-
The default collection is implementation-defined. (See 5.3.3.2 Other Components of the XPath Dynamic Context)
► A default collection name may be defined at
Configuration
level; this is then resolved in the same way as any other collection URI. In the absence of such a definition, the default collection is empty. -
Streamed processing may be initiated by invoking the transformation with an initial mode declared as streamable, while supplying the initial match selection (in an implementation-defined way) as a streamed document. (See 6.6.4 Streamable Templates)
► If the initial mode is streamable, then for streaming to take place, the source document must be supplied as a
StreamSource
orSAXSource
. It is also possible to use the output of one transformation as the streamed input to another. -
The mechanism by which the caller supplies a value for a stylesheet parameter is implementation-defined. (See 9.5 Global Variables and Parameters)
► In s9api, use
Xslt30Transformer.setStylesheetParameters()
. In JAXP, useTransformer.setParameter()
. On the command line, use aname=value
pair as a command line option. -
The detail of any external mechanism allowing a processor to enable or disable checking of assertions is implementation-defined. (See 23.2 Assertions)
► On the command line, use the
-ea
option to enable assertion checking. In s9api, assertions must be enabled at compile time usingXsltCompiler.setAssertionsEnabled(true)
; if required they can then be disabled at evaluation time usingXslt30Transformer.setAssertionsEnabled(false)
. -
The way in which the results of the transformation are delivered to an application is implementation-defined. (See 25 Transformation Results)
► Results are delivered to a user-supplied result document handler. The default mechanism serializes result trees to files in filestore.
-
It is implementation-defined how the URI appearing in the
href
attribute ofxsl:result-document
affects the way in which the result tree is delivered to the application. There may be restrictions on the form of this URI. (See 25.1 Creating Secondary Results)► This can be customized by use of a user-supplied result document handler. By default, result documents are serialized to files in filestore, which implies that the URIs must use the
file
URI scheme. -
If serialization is supported, then the location to which a final result tree is serialized is implementation-defined, subject to the constraint that relative URI references used to reference one tree from another remain valid. (See 26 Serialization)
► This can be customized by use of a user-supplied result document resolver. By default, result documents are serialized to files in filestore, which implies that the URIs must use the
file
URI scheme.
F.2 Vendor and User Extensions
This category covers extensions and extensibility: mechanisms for providing vendor or user extensions to the language without sacrificing interoperability.
In general terms, it is implementation-defined:
-
whether and under what circumstances the implementation recognizes any extension functions, extension instructions, extension attributes, user-defined data elements, additional types, additional serialization methods or serialization parameters, or additional collations, and if so, what effect they have.
► Extensions implemented by the Saxon processor are documented at Extensions.
-
whether, how, and under what circumstances the implementation allows users to define extension functions, extension instructions, extension attributes, user-defined data elements, additional types, additional serialization methods or serialization parameters, or additional collations. If it does allow users to do so, it must follow the rules given elsewhere in this specification.
► Mechanisms provided by the Saxon processor for implementing extension functions and extension instructions are documented at Extensibility mechanisms. Mechanisms for extending the serialization capability are available via the method
Configuration.setSerializerFactory()
. Collations can be defined at configuration level either by registering individual collations usingConfiguration.registerCollation()
, or by supplying a user-writtenCollationURIResolver
. -
what information is available to such extensions (for example, whether they have access to the static and dynamic context.)
► Some of the mechanisms for implementing extension instructions and extension functions provide the implementation of the instruction or function with information about the static and dynamic context.
-
where such extensions are allowed, the extent to which the processor enforces their correct behaviour (for example, checking that strings returned by extension functions contain only valid XML characters)
► By default the results of extensions are checked, but the implementation of an extension can assert that the result is to be trusted.
More specifically:
-
The mechanisms for creating new extension instructions and extension functions are implementation-defined. It is not required that implementations provide any such mechanism. (See 2.8 Extensibility)
► Mechanisms provided by the Saxon processor for implementing extension functions and extension instructions are documented at Extensibility mechanisms.
-
The set of namespaces that are specially recognized by the implementation (for example, for user-defined data elements, and extension attributes) is implementation-defined. (See 3.7.3 User-defined Data Elements)
► Saxon recognizes the namespace
http://saxon.sf.net/
for its own extensions; it also recognizes extensions in various namespaces defined by theEXSLT
andEXPath
communities. -
The effect of user-defined data elements whose name is in a namespace recognized by the implementation is implementation-defined. (See 3.7.3 User-defined Data Elements)
► Saxon only recognizes user-defined data elements in the namespace
http://saxon.sf.net/
. Any other user-defined data elements are ignored. -
An implementation may define mechanisms, above and beyond
xsl:import-schema
, that allow schema components such as type definitions to be made available within a stylesheet. (See 3.14 Built-in Types)► Saxon allows schemas to be loaded into the configuration in a number of ways, but type definitions can generally be used in a stylesheet only if the namespace is explicitly imported using
xsl:import-schema
. The exception is types corresponding to external Java objects: every Java class on the classpath has a corresponding named external type definition which is implicitly imported.► If syntax extensions are enabled, Saxon allows union types to be defined inline using syntax such as
union(xs:date, xs:dateTime)
anywhere that anItemType
is expected. -
The set of extension functions available in the static context for the target expression of
xsl:evaluate
is implementation-defined. (See 10.4.1 Static context for the target expression)► All extension functions available within a stylesheet are also available in XPath expressions dynamically evaluated using
xsl:evaluate
. -
If the
data-type
attribute of thexsl:sort
element has a value other thantext
ornumber
, the effect is implementation-defined. (See 13.1.2 Comparing Sort Key Values)► No additional values are recognised.
-
The posture and sweep of extension functions (and references to extension functions) and extension instructions are implementation-defined. (See 19.8.4.2 Streamability of extension instructions)
► Extension functions and instructions are not streamable, with the exception of the
saxon:stream()
extension function. -
Additional streamability categories for stylesheet functions may be defined by an implementation. (See 19.8.5 Classifying Stylesheet Functions)
► No additional categories are recognized for streamable stylesheet functions.
-
The effect of an extension function returning a string containing characters that are not permitted in XML is implementation-defined. (See 24.1.2 Calling Extension Functions)
► The results are not checked.
-
The way in which external objects are represented in the type system is implementation-defined. (See 24.1.3 External Objects)
► In addition to nodes, atomic values, and functions, Saxon supports a fourth kind of item: the external Java (or .NET) object. The value of such an item is simply a wrapper for the external object. These have types which correspond to the Java or .NET class hierarchy.
F.3 Localization
This specification, and the specifications that it refers to, include facilities for adapting the output of a transformation to meet local expectations: examples include the formatting of numbers and dates, and the choice of collations for sorted output. The general principles are:
-
The specification does not mandate any particular localizations that processors must offer: for example, a conformant processor might choose to provide output in Japanese only.
-
The specification provides fallback mechanisms so that if a particular localization is requested and is not available, processing does not fail.
More specifically:
-
The combinations of languages and numbering sequences recognized by the
xsl:number
instruction, beyond those defined as mandatory in this specification, are implementation-defined. There may be implementation-defined upper bounds on the numbers that can be formatted using any particular numbering sequence. There may be constraints on the values of theordinal
attribute recognized for any given language. (See 12.4 Number to String Conversion Attributes)► SaxonJ uses the ICU4J library for localization. This offers a large and extensible set of languages. The numbering sequences recognized are listed at xsl:number.
► SaxonCS uses the ICU4N library for localization. This does not include support for numbering sequences (such as spelled-out numbering, one, two, three). SaxonCS therefore supports such sequences only for English.
-
The facilities for defining collations and allocating URIs to identify them are largely implementation-defined. (See 13.1.3 Sorting Using Collations)
► Mechanisms provided by the Saxon processor for implementing extension functions and extension instructions are documented at Extensibility mechanisms. Mechanisms for extending the serialization capability are available via the method
Configuration.setSerializerFactory()
. Collations can be defined at configuration level either by registering individual collations usingConfiguration.registerCollation()
, or by supplying a user-writtenCollationURIResolver
. -
The algorithm used by
xsl:sort
to locate a collation, given the values of thelang
andcase-order
attributes, is implementation-defined. (See 13.1.3 Sorting Using Collations)► If these attributes are present then the Unicode Collation Algorithm is used, selected by a collation URI that incorporates these two parameters.
-
If none of the
collation
,lang
, orcase-order
attributes is present (onxsl:sort
), the collation is chosen in an implementation-defined way. (See 13.1.3 Sorting Using Collations)► By default, Unicode codepoint collation is used.
-
When using the family of URIs that invoke the Unicode Collation Algorithm, the effect of supplying a query keyword or value not defined in this specification is implementation-defined. The defaults for query keywords are also implementation-defined unless otherwise stated. (See 13.4 The Unicode Collation Algorithm)
► By default, unrecognized parameters are ignored.
F.4 Optional Features
As well as the optional conformance features identified in 27 Conformance, some specific features of the specification are defined to be optional.
-
It is implementation-defined whether an XSLT 3.0 processor supports backwards compatible behaviour for any XSLT version earlier than XSLT 3.0. (See 3.9 Backwards Compatible Processing)
► XSLT 1.0 and XSLT 2.0 backwards compatibility are supported as defined in the W3C specification, in Saxon-HE from 9.8.0.7, or for earlier versions of 9.8 in Saxon-PE and Saxon-EE only.
-
If an
xml:id
attribute that has not been subjected to attribute value normalization is copied from a source tree to a result tree, it is implementation-defined whether attribute value normalization will be applied during the copy process. (See 11.9.1 Shallow Copy)► Attribute value normalization is applied.
-
It is implementation-defined whether, and under what circumstances, disabling output escaping is supported. (See 26.2 Disabling Output Escaping)
► Disable-output-escaping is supported provided that the result tree is being serialized, and that no
xsl:try
orxsl:fork
instruction is in effect.
F.5 Dependencies
When this specification refers normatively to other specifications, it generally gives implementations freedom to decide (within constraints) which version of the referenced specification should be used. Specifically:
-
It is implementation-defined which versions and editions of XML and XML Namespaces (1.0 and/or 1.1) are supported. (See 4.1 XML Versions)
► Both 1.0 and 1.1 are supported provided support is available from the chosen XML parser. XML 1.1 is available only if explicitly requested.
SaxonCS does not support XML 1.1 because the Microsoft
System.Xml.XmlReader
family of parsers do not support it. -
It is implementation-defined which versions of XML, HTML, and XHTML are supported in the
version
attribute of thexsl:output
declaration. (See 26 Serialization)► XML 1.0 and 1.1 are supported; HTML 4 and 5 are supported; XHTML 1 and 5 are supported.
Note that XML 1.1 serialization is supported even in SaxonCS.
-
It is implementation-defined whether (and if so how) an XSLT 3.0 processor is able to work with versions of XPath later than XPath 3.1. (See 27 Conformance)
► The question does not yet arise.
-
It is implementation-defined whether (and if so how) an XSLT 3.0 processor is able to work with versions of [XSLT and XQuery Serialization] later than 3.1. (See 27.3 Serialization Feature)
► The question does not yet arise.
F.6 Defaults and Limits
To accommodate variations in the way that the XSLT language is deployed, and the constraints of different processing environments, defaults for some options are implementation-defined. In addition, limits on the sizes of ranges of values permitted are in general implementation-defined:
-
Limits on the value space of primitive datatypes, where not fixed by [XML Schema Part 2], are implementation-defined. (See 4.8 Limits)
► For integers, decimals, and strings, the only limits imposed by Saxon are those inherent in the underlying Java types
BigInteger
,BigDecimal
, andString
.For calendar data types, the year must be in the range of a signed 32-bit integer; seconds are supported to a fractional precision of nine digits (that is, nanosecond precision).
For durations, the number of months must fit in a signed 32-bit integer; the integer number of seconds must fit in a signed 64-bit integer, and the precision is to nanoseconds.
The maximum length of a sequence (or array) is limited to 231-1 items.
-
The default value of the
encoding
attribute of thexsl:output
element is implementation-defined. Where the encoding is UTF-8, the default for thebyte-order-mark
attribute is implementation-defined. (See 26 Serialization)► The default encoding is UTF-8; by default, no byte order mark is written.
F.7 Detection and Reporting of Errors
Some aspects of error handling are implementation-defined:
-
It is implementation-defined whether type errors are signaled statically. (See 2.12 Error Handling)
► Type errors are signaled statically where the intersection of the required type and the (statically-inferred) supplied type is empty.
-
If the effective version of any element in the stylesheet is not 1.0 or 2.0 but is less than 3.0, the recommended action is to report a static error; however, processors may recognize such values and process the element in an implementation-defined way. (See 3.9 Backwards Compatible Processing)
► Saxon reports a warning and treats the value as 2.0.
-
The default values for the
warning-on-no-match
andwarning-on-multiple-match
attributes ofxsl:mode
are implementation-defined. (See 6.6.1 Declaring Modes)► The default values are
no
andyes
respectively. -
The form of any warnings output when there is no matching template rule, or when there are multiple matching template rules, is implementation-defined. (See 6.6.1 Declaring Modes)
► The warning, by default, consists of an explanatory English-language message sent to the system error output; both the form of the message and its destination may be customized.
-
The destination and formatting of messages written using the
xsl:message
instruction are implementation-defined. (See 23.1 Messages)► By default messages are serialized as XML and sent to the system error output; both the form of the message and its destination may be customized.