Project

Profile

Help

Bug #6340 » bug.xsl

Matt Patterson, 2024-02-06 15:11

 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math saxon"
version="3.0">

<xsl:output method="xml" indent="yes"/>

<!-- if streamable="yes" is removed from the <xsl:accumulator> and the
<xsl:mode>, all versions of the <xsl:accumulator-rule> below run without error -->
<xsl:accumulator streamable="yes" as="xs:string*" name="tags" initial-value="()">
<!-- works -->
<!--<xsl:accumulator-rule match="tag" phase="end" saxon:capture="yes" select="($value, string(.))"/>-->
<!--<xsl:accumulator-rule match="tag/text()" phase="end" select="($value, string(.))"/>-->
<!-- explodes -->
<xsl:accumulator-rule match="tag/text()" saxon:capture="yes" phase="end" select="($value, string(.))"/>
</xsl:accumulator>
<xsl:mode on-no-match="shallow-skip" use-accumulators="tags" streamable="yes"/>

<xsl:template match="/">
<tags>
<xsl:for-each select="accumulator-after('tags')">
<tag><xsl:value-of select="."/></tag>
</xsl:for-each>
</tags>
</xsl:template>

</xsl:stylesheet>
(1-1/2)