Actions
Bug #2714
closedStreamed grouping using xsl:for-each-group group-starting-with and snapshot(current-group())/.. gives different result than unstreamed grouping
Start date:
2016-04-16
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.6, 9.7, trunk
Fix Committed on Branch:
9.6, 9.7, trunk
Description
I have the following XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math"
version="3.0">
<xsl:mode streamable="yes"/>
<xsl:output indent="yes"/>
<xsl:template match="note">
<xsl:copy>
<xsl:for-each-group select="*/text()" group-starting-with="text()[ends-with(., ':')]">
<group>
<xsl:copy-of select="snapshot(current-group())/.."/>
</group>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When run with Saxon 9.7.0.4 EE against the input sample
<?xml version="1.0" encoding="UTF-8"?>
<note>
<para>customer name :</para>
<para>mr. Joe Someone</para>
<para>calling from :</para>
<para>1234567</para>
<para>device model :</para>
<para>ABC-123</para>
<para>issue:</para>
<para>some info</para>
<para>some more info</para>
<para>and even more info</para>
<para>solution :</para>
<para>some solutions</para>
<para>and some more solutions</para>
</note>
Saxon compiles and runs the XSLT but produces the following result:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<group>
<para>mr. Joe Someone</para>
<para>calling from :</para>
</group>
<group>
<para>1234567</para>
<para>device model :</para>
</group>
<group>
<para>ABC-123</para>
<para>issue:</para>
</group>
<group>
<para>some info</para>
<para>some more info</para>
<para>and even more info</para>
<para>solution :</para>
</group>
<group>
<para>some solutions</para>
<para>and some more solutions</para>
<para>
</para>
</group>
</note>
So some grouping has happened but the group contents in the result groups seems rather messed up. For comparison, the same code minus the <xsl:mode streamable="yes"/>
produces the wanted result:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<group>
<para>customer name :</para>
<para>mr. Joe Someone</para>
</group>
<group>
<para>calling from :</para>
<para>1234567</para>
</group>
<group>
<para>device model :</para>
<para>ABC-123</para>
</group>
<group>
<para>issue:</para>
<para>some info</para>
<para>some more info</para>
<para>and even more info</para>
</group>
<group>
<para>solution :</para>
<para>some solutions</para>
<para>and some more solutions</para>
</group>
</note>
This is also the result I get with Exselt for both versions of the XSLT (with <xsl:mode streamable="yes"/>
and without it).
Please register to edit this issue
Actions