[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSLT Streaming versus SAX and STaX?

Subject: Re: [xsl] XSLT Streaming versus SAX and STaX?
From: "Abel Braaksma (Exselt) abel@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 Oct 2014 03:13:31 -0000

Apart from the pun-intended earlier answers from some list members, I think
there is some merit in your question. In SAX, an XML source is processed top
to bottom, depth-first. I have not worked with SAX recently, but I think it is
a one-way street: only down.

Streaming XSLT is standardized with that idea in mind: one pass through the
document and to achieve that, only downward selects are allowed (generally

I think the pattern that most closely resembles SAX, or at least can be mapped
to it, is accumulators, which define an action to be taken and remembered when
a certain pattern is matched (much like xsl:template, but with accumulators,
the result becomes a property of the node, so that you can access it without
having to go back if you need this node info later in the process).

Generally speaking, what you can do with SAX, you can also do with streaming
in XSLT 3.0, both give you enough tools at hand to process an XML document in
a streaming way. I would, however, dare to think that XSLT is more suited for
the task, as transformations are its natural habitat.

Also generally speaking: if you understand the model of SAX (or the .NET
equivalent of XmlReader) then you will likely have less trouble understanding
the logic and rules of XSLT streaming, whereas if you only ever used a DOM
approach, adopting streaming will likely be much harder.

Abel Braaksma
Exselt XSLT 3.0 streaming processor

> -----Original Message-----
> From: Costello, Roger L. costello@xxxxxxxxx [mailto:xsl-list-
> How would you answer this question:
> 	Is XSLT streaming like SAX and STaX?
> 	How does it differ?

Current Thread