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
Saxonica


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 9.3.0.5, run through oxYgen:

<xsl:stylesheet version="3.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:saxon="http://saxon.sf.net/"
    exclude-result-prefixes="xs saxon">

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


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.
http://p.sf.net/sfu/alienvault_d2d_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help