<?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>29803</bug_id>
          
          <creation_ts>2016-09-02 15:44:45 +0000</creation_ts>
          <short_desc>[XSLT30] We accidentally lost the ability to use accumulators on streamed nodes in the initial match selection, and other remnants of removing @streamable from xsl:global-context-item</short_desc>
          <delta_ts>2016-09-09 21:41:53 +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>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</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="Abel Braaksma">abel.braaksma</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>127274</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-09-02 15:44:45 +0000</bug_when>
    <thetext>This bug applies to section 18.2.2, Applicability of Accumulators.

After we dropped @streamable from xsl:global-context-item (GCI) as a resolution to bug 29696, we lost the ability to declaratively specify what accumulators apply to a given input tree from a the initial match selection (IMS).

In the previous situation, if the GCI == IMS, the @use-accumulators applied to both. We dropped this, so we lost the ability to specify what accumulators should or should not be calculated on streamed IMS&apos;s.

There are some ways we can fix this:

1) Add @use-accumulators as an attribute to xsl:stylesheet/transform/package, only to apply to the containing package (similar to the scope of its accumulators).

Advantages: simple to add, not so disruptive

Disadvantages: it requires access to its child elements (i.e., it is a forward declaration), which we do not allow otherwise

2) Add a declaration xsl:initial-match-selection with @streamable and @use-accumulators. The semantics would be that *if* the IMS contains one or more streamed nodes, these accumulators are applicable. It is ignored for non-streamed nodes, or if @streamable=&quot;no&quot; (similar to xsl:merge-source).

Advantages: clear to the end user what its meaning is, fixes the use-case and makes it programmable with shadow attributes.

Disadvantages: it is a new declaration and we rather not add new stuff in CR

3) Leave the status-quo as is, but specify the default: either #all, or #none.

Advantages: no new syntax needed

Disadvantages: leaves the implementation-defined behavior in place if a user wants to specify something different.

4) Do nothing

Advantages: nothing to change

Disadvantages: makes using streamable accumulators highly implementation-dependent with potentially big interoperability issues

5) Require that implementations provide a @use-accumulators type of functionality, which we can by describing this under 2.3.2. Priming a stylesheet.

Advantages: it makes this feature testable and, while API dependent, a reliable part of any implementation that supports the streaming feature, which improves interoperability.

Disadvantages: user can only set this by the API


-------------------------------------

Some other observations (editorial):

Under 18.2.2 the following paragraph should be dropped:

&quot;When a streamed node is supplied as the global context item, the set of accumulators applicable to the document containing the global context item can be declared using the use-accumulators attribute of the xsl:global-context-item declaration. (Note that this is only useful when the global context item is also present in the initial match selection, since references to a streamable global context item per se are always motionless.)&quot;

Also under 18.2.2, remove xsl:global-context-item:

&quot;The accumulator is declared as being applicable to the tree in question, using the use-accumulators attribute on xsl:source-document, xsl:merge-source, or xsl:global-context-item; or&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127333</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-07 23:07:16 +0000</bug_when>
    <thetext>I agree there&apos;s a gap here.

I&apos;m inclined to say we should add a @use-accumulators attribute to xsl:mode, applicable only when streamable=&quot;yes&quot;. The semantics are: when the mode is used as the initial mode for apply-templates invocation of the stylesheet, then for any streamed (document?) node that is present in the initial match selection, the specified accumulators will be maintained for that document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127336</commentid>
    <comment_count>2</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-09-08 08:43:13 +0000</bug_when>
    <thetext>Re comment#1: I think I didn&apos;t list xsl:mode as candidate as I was worried about overriding. Accumulators are local to a package, and overriding them seems to me to allow them to be accessible at least within overriding templates.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127358</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-09 21:41:53 +0000</bug_when>
    <thetext>We agreed to adopt comment #1: put the use-accumulators attribute on the xsl:mode declaration for the initial mode. The changes have been applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>