Re: [xsl] [XSLT Streaming] How do I know that my input document was processed in a streaming fashion?

Subject: Re: [xsl] [XSLT Streaming] How do I know that my input document was processed in a streaming fashion?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 27 Aug 2013 22:04:16 +0100
On 27 Aug 2013, at 20:02, Costello, Roger L. wrote:

> Hi Folks,
>
> I want to count the number of Book elements in BookCatalogue.
>
> I want to do it using XSLT Streaming.
>
> Below are two solutions. One uses <xsl:stream>, the other uses <xsl:mode>.
>
> Two Questions Please:
>
> 1. Are my two solutions equivalent?

Yes. And in fact, I suspect that xsl:stream is redundant, in that there's
nothing it can do that you can't do with

<xsl:apply-templates select=doc() mode=streaming>

(We had ambitions for xsl:stream to add more attributes controlling the way in
which the document was read, but these are largely unrealised.)
>
> 2. I ran my solutions and they produced the correct result. They ran fast,
but the input document is small (only 3 Books). How do I know that the input
document was actually processed in a streaming fashion?

In Saxon, largely by (a) the absence of a message telling you that it's
building a tree, and (b) the presence of messages in the "explain" output, and
(c) the fact that you don't run out of memory when the document gets big.
There's no standard way of doing it programmatically. It might be nice if
there was.

Note that running fast is NOT a benefit you should expect from streaming. With
Saxon, streaming is slower than in-memory processing. Perhaps the difference
will get smaller in time, but at the moment, it's a space/time trade-off - you
give the processor less memory, so it takes more time. The benefit of
streaming is that you can process very large documents with very small amounts
of memory, full stop.
>
>

Michael Kay
Saxonica

Current Thread