With regard to XSLT as query language three pieces are missing.

Support for data types

XSLT 2.0 introduced the capability to declare the required types of, among other things, variables. The type can be a built-in or a user-defined type imported from an XML schema. Schematron is currently missing both: The possibility to declare the required type of a variable and to import user-defined data types.

Setting up accumulators

XSLT 3.0 added accumulators as a new mechanism to capture and process data. An accumulator associates a series of values with nodes of the document tree. The value of an accumulator is obtained by calling the respective accumulator functions fn:accumulator-before() and fn:accumulator-after(). Although accumulators are designed for streaming transformations they can also be used with non-streaming transformations.

Loading user-defined libraries

The addition of user-defined functions in XSLT 2.0 opened up the possibility of reusable, user-defined function libraries. XSLT 3.0 made the notion of user-defined libraries explicit by adding packages, collections of stylesheet modules with a controlled interface.

Schematron lacks a way of including user-defined function libraries other than using schema composition instructions. But neither sch:include nor sch:extends is a good fit. The former inserts the content of an XML document in place of the element, the latter is only allowed to extend a rule. [2]

To address these missing pieces the query language specification for XSLT should be expanded as follows:

Table 2. Query language environment for XSLT (proposed additions marked with an asterisk)

 XSLT 1.0XSLT 2.0XSLT 3.0
User-defined libraries*xsl:include, xsl:importxsl:include, xsl:importxsl:include, xsl:import, xsl:use-package
Typed variables*-sch:let/assch:let/as
User-defined types*-sch:import-schemasch:import-schema