Re: [xsl] [Summary] An efficient XSLT program that searches a large XML document for all occurrences of a string

Subject: Re: [xsl] [Summary] An efficient XSLT program that searches a large XML document for all occurrences of a string
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 3 May 2024 07:54:30 -0000
On 03/05/2024 09:48, Roger L Costello costello@xxxxxxxxx wrote:
>
> I decided to go the XSLT streaming route. Below is my summary of how to do
it.
>
>
>
> So I went with XSLT streaming. Here's how to do it.
>
> The SAXON documentation [1] says this: "Using the xsl:source-document
instruction, with the attribute streamable="yes". Here the source document is
identified within the stylesheet itself. Typically such a stylesheet will have
a named template as its entry point, and will not have any principal source
document supplied externally."


Roger, you can as well start with normal but streamed processing based
on template matching just by declaring

 B  <xsl:mode streamable="yes"/>

and then have e.g.

 B  <xsl:template match="/">

 B B B B B B B B B B  <results>
 B B B B B B B B B B B B B B B  <xsl:for-each select="//text()[. eq 'DNKK']">
 B B B B B B B B B B B B B B B B B B B  <result>
 B B B B B B B B B B B B B B B B B B B B B B B  <xsl:element
name="{name(..)}">DNKK</xsl:element>
 B B B B B B B B B B B B B B B B B B B B B B B  <parent><xsl:value-of
select="name(../..)"/></parent>
 B B B B B B B B B B B B B B B B B B B  </result>
 B B B B B B B B B B B B B B B  </xsl:for-each>
 B B B B B B B B B B B  </results>

 B  </xsl:template>

or the code I posted.


For streaming you don't need a named template and xsl:source-document.

Current Thread