<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26737</bug_id>
          
          <creation_ts>2014-09-05 14:11:31 +0000</creation_ts>
          <short_desc>[xslt3.0] Editorial: accumulators</short_desc>
          <delta_ts>2015-10-29 09:50:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>111066</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-09-05 14:11:31 +0000</bug_when>
    <thetext>NOTE: the attribute xsl:accumulator-rule/@phase is optional, but I don&apos;t think we define a default. I think phase=&quot;start&quot; 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&apos;t have the attribute streamable=&quot;yes&quot;, 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(&apos;publisher&apos;)+1 )
       else map:put($value, @publisher, 1)&quot;/&gt;

 
NOTE: we don&apos;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(&apos;firstTitle&apos;) is to return the value of the first title element.

NOTE: we might add a note that having a phase=&quot;end&quot; 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=&quot;end&quot; rules.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111069</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-09-05 14:42:35 +0000</bug_when>
    <thetext>Except for the absence of an example of accmulators invoking other accumulators, these changes have been applied (editorially).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>