Streaming of Large Documents

Sometimes source documents are too large to hold in memory. Saxon-EE provides a range of facilities for processing such documents in streaming mode: that is, processing data as it is read by the XML parser, without building a complete tree representation of the document in memory.

Some of these facilities implement new features in the draft XSLT 3.0 recommendation. Some are specific to Saxon, and a few facilities are also available in XQuery.

Inevitably there are things that cannot be done in streaming mode - sorting is an obvious example. Sometimes, achieving a streaming transformation means rethinking the design of how it works - for example, splitting it into multiple phases. So streaming is rarely a case of simply taking your existing code and setting a simple switch to request streamed implementation.

There are basically two ways of doing streaming in Saxon:

Both these facilities are available in Saxon-EE only. Streamed templates also require XSLT 3.0 to be enabled by setting the relevant configuration parameters or command line options.