Saxonica Community: W3C XSLT 3.0 Streaming analysis tool

Saxonica Community

Last mod: Wednesday 2014jan29

XSLT3.0 Streaming Processing

A Major feature of XSLT3.0 is the ability to process large documents in a streaming manner, that is as they are parsed and without building a complete tree representation for the document in memory.

A consequence is that operations and instructions cannot 'go back' through the document. This limits the operations and XPath constructs that can be used. However, in order to maximise the possibility of streaming, a series of very detailed rules for guaranteeing streamability have been drawn up. These rules are sufficiently complex that machine-aided analysis of a program is needed to determine such a guarantee (or why it cannot be guaranteed) for an arbitrary stylesheet.

Example Streamability Analyzer

Example Stream Analyzer is an initial example of such an analysis tool that operates on some of the examples from section 18 of the Working Spec. It must be considered merely as an illustration.

The tool allows you to either:

The resulting analysis is then displayed in a nominal serialised form. (Strict indentation is used, closing tags are omitted.) A parallel (annotated) version of the XSLT3.0 Working Draft is also displayed either in a separate tag or window, dependent on your browser configuration.

Actions available include:

A stylesheet is converted into an abstract tree, where all XPath expressions (in @select,@test,@match and attribute value templates) have been parsed into the appropriate nested terms. In addition pseudo sequence constructor elements have been inserted into XSLT instructions, to make rule application and explanation easier.

This tree is then processed in two sweeps:

  1. Operand roles are determined and recorded as attributes; the static type of instructions and expressions is then determined, by propagating a context item type on the way down and assessing static type on the climb back up the tree.
  2. The posture and sweep of the constructs is then assessed, against the rules from the Working Draft.

The results are then used to generate a web page that contains serialised versions of the results, and whose interactivity is supported by a simple Saxon-CE stylesheet.

The tool attempts to use table and model-driven processing as much as possible, using the following structures:


One of the major issues is trying to preserve screen real-estate... things get quite big quite quickly.