A little embarrassing this...

It's true that the uri-collection() function was added in large measure for streaming applications. Saxon's CollectionURIResolver interface has been redesigned to make this possible, by allowing it to return a sequence of URIs rather than document nodes. However, the StandardCollectionURIResolver issued with the product and used by default does not yet take advantage of this capability. This is an oversight (probably because our main test driver uses its own CollectionURIResolver rather than the default one).

I'll log this as a bug. In the meantime you could consider writing a CollectionURIResolver based on the standard one, but modified to return URIs without dereferencing them.

Michael Kay

On 14 May 2013, at 10:45, David Rudel wrote:

I have found the reason for one of my streaming problems.

I am using uri-collection to read in a bunch of URIs. The xslt3 documentation indicates that one of the reasons uri-collection may be favored over collection() is that the former allows streaming.

However, running the following with the -t command indicates that uri-collection() is causing entire trees to be written into memory in Saxon, run through oxYgen:

<xsl:stylesheet version="3.0"
    exclude-result-prefixes="xs saxon">

    <xsl:template match="/">
<xsl:variable name="path" select="replace(base-uri(),'(.*/)[^/]+?.xml','$1')"/>
    <xsl:for-each select="(uri-collection(concat($path,'?select=*.xml;recurse=yes;on-error=ignore')))">
        <xsl:value-of select="."/>

I also tried using xsl:iterate and saxon:iterate [based on the information in the documentation for Saxon 9.3], and trees were being built in all cases.

I don't see how to use saxon:stream() in this case because the entire tree is being built by uri-collection() before the document ever sees saxon:stream().


"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
saxon-help mailing list archived at http://saxon.markmail.org/