Re: [xsl] Can a streaming loop be inside a non-streaming loop?

Subject: Re: [xsl] Can a streaming loop be inside a non-streaming loop?
From: "Michael Kay michaelkay90@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Aug 2025 11:38:06 -0000
The basic issue here is that you can't bind a variable to a streamed node
(because it would lose its value when you move past that node). And underlying
that is that you're trying to make multiple passes over the streamed content,
which isn't allowed: you can only move fowards in the file, never back.

Since the multiple passes are each processing the whole document, I would do:

> <xsl:template name="main">
>    <xsl:for-each select="$identifiers/identifier">
>        <xsl:variable name="ident" select="."/>
>        <xsl:source-document href="records.xml"
>                                                streamable="yes">
>            <results>
>                <xsl:variable name="records" select="/*"/>
>                    <xsl:for-each select="/*/record/copy-of()">
>                        ...
>                    </xsl:for-each>
>                </xsl:for-each>
>            </results>
>        </xsl:source-document>
       </xsl:for-each>
>    </xsl:template>



Michael Kay
Saxonica

Current Thread