Actions
Bug #4786
closedaccumulator value of root node is wrong when not using streaming
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2020-10-07
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
10, 9.9, trunk
Fix Committed on Branch:
10, 9.9, trunk
Fixed in Maintenance Release:
Platforms:
Description
It seems that Saxon Java (tested with Saxon 10.2 HE and EE) wrongly computes the accumulator-before
value of the root node of a tree e.g. for the example document
<?xml version="1.0" encoding="UTF-8"?>
<foo/>
and the sample stylesheet
<?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"
exclude-result-prefixes="#all"
version="3.0">
<xsl:output indent="yes" omit-xml-declaration="yes"/>
<xsl:accumulator name="a1" as="xs:string" initial-value="'init'" streamable="yes">
<xsl:accumulator-rule match="document-node()" select="$value || ', ' || 'matched root /'"/>
<xsl:accumulator-rule match="node()" select="$value || ', ' || 'matched node /' || ancestor-or-self::node()/node-name() => string-join('/')"/>
</xsl:accumulator>
<xsl:param name="p1">
<foo/>
</xsl:param>
<xsl:template name="xsl:initial-template">
<xsl:source-document href="sample1.xml" streamable="yes" use-accumulators="a1">
<xsl:apply-templates select="." mode="accu-test"/>
</xsl:source-document>
</xsl:template>
<xsl:mode name="accu-test" streamable="yes"/>
<xsl:template match="." mode="accu-test">
<processed node="/{ancestor-or-self::node()/node-name() => string-join('/')}" accumulator-value="{accumulator-before('a1')}"/>
<xsl:apply-templates mode="#current"/>
</xsl:template>
</xsl:stylesheet>
processing with streaming gives the (in my view correct) result
<processed node="/" accumulator-value="init, matched root /"/>
<processed node="/foo" accumulator-value="init, matched root /, matched node /foo"/>
while processing without streaming gives the wrong result for the value of the accumulator on the root node:
<processed node="/" accumulator-value="init"/>
<processed node="/foo" accumulator-value="init, matched root /, matched node /foo"/>
Somehow the value output for the root node is only the initial value but the matching rule's select expression doesn't seem to be applied when giving the accumulator value for the root, although for the child node the value added by the rule for the root node is included.
Please register to edit this issue
Actions