This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26737 - [xslt3.0] Editorial: accumulators
Summary: [xslt3.0] Editorial: accumulators
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-05 14:11 UTC by Michael Kay
Modified: 2015-10-29 09:50 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2014-09-05 14:11:31 UTC
NOTE: the attribute xsl:accumulator-rule/@phase is optional, but I don't think we define a default. I think phase="start" was intended (and is assumed in some of our examples). 

NOTE: the schema for XSLT 3.0 incorrectly permits xsl:accumulator/@post-descent

NOTE: the example in 18.2.4 appears to be incorrect. accumulator-before() returns the pre-descent value of the accumulator, which is the value AFTER the initial node visit. So to get the sequence 1,2,3, ... the initial value should be zero. This also applies to the example in 18.2.5.

NOTE: the first example in 18.2.8 is not streamable, as it claims. It doesn't have the attribute streamable="yes", and the select attribute on the accumulator rule is not motionless.

NOTE: the last example in 18.2.8 has syntax problems. The first map:put() has unmatched parens; the second has a colon that should be a comma. There also seems to be a semantic problem: the accumulator is calling itself. I think the body of the rule should be:

if (map:contains($value, @publisher)) 
       then map:put($value, @publisher, $value('publisher')+1 )
       else map:put($value, @publisher, 1)"/>

 
NOTE: we don't have any examples of accumulators calling each other. I think Abel had a use case?

NOTE: for childless nodes, it appears that accumulator-before() and accumulator-after() return the same value: the value after applying the phase=start rules will always be the same as the value before applying the phase=end rules.

NOTE: the names accumulator-before() and accumulator-after() are certainly confusing. Consider the example in 18.2.8, where the meaning of the function call accumulator-before('firstTitle') is to return the value of the first title element.

NOTE: we might add a note that having a phase="end" rule that matches the document node is useless, because there is no way of getting the final value. Calling accumulator-after returns the value BEFORE applying the phase="end" rules.
Comment 1 Michael Kay 2014-09-05 14:42:35 UTC
Except for the absence of an example of accmulators invoking other accumulators, these changes have been applied (editorially).