Streamed processing of input documents

The implementation of the saxon:stream() extension function (and the equivalent saxon:stream pragma) has been simplified: it is now rewritten directly into an xsl:source-document instruction.

The streaming code has been improved so that it is much less inclined to make copies of subtrees where these are not needed, even when an <xsl:copy-of> instruction is used. For example, <xsl:copy-of> as a child of an element constructor instruction is now implemented as <xsl:sequence> (by sending incoming SAX parser events straight to the output destination). This can greatly reduce memory requirements, especially for grouping applications.

When parsing of the source document finishes early because no further input is required, a QuitParsingException is now notified to the warning() method of the registered ErrorListener. This can usually be ignored; but it is sometimes useful to know that the source file has not been read to completion (which means, for example, that it has not been completely validated).

Streaming stylesheet functions are now implemented.

The concept of streaming extensions has been dropped. Saxon now aims to conform to the XSLT 3.0 streamability rules with no restrictions and no extensions. However, Saxon still checks streamability after optimization has been performed, which may sometimes result in non-streamable code being rewritten in a way that is streamable, for example when non-streamable constructs are completely optimized away.

The (partial) implementation of "crawling" streamability in instructions such as xsl:apply-templates and xsl:for-each-group has therefore been dropped. In accordance with the XSLT 3.0 specification, Saxon now requires the select expression of such instructions to be striding: that is, the select expression can use the child axis but not the descendant axis.