<?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>29805</bug_id>
          
          <creation_ts>2016-09-02 16:47:55 +0000</creation_ts>
          <short_desc>[XSLT30] Allow xsl:source-document/@use-accumulators to be present when streamable=no</short_desc>
          <delta_ts>2016-09-09 21:24:32 +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>127276</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-09-02 16:47:55 +0000</bug_when>
    <thetext>(I raised this bug following the discussion thread in https://lists.w3.org/Archives/Public/public-xsl-wg/2016Sep/0003.html.)

Following up on yesterday&apos;s telcon discussion, I changed my mind on my standpoint and would like to propose that we lift the requirement that xsl:source-document/@use-accumulators cannot be used together with xsl:source-document/@streamable=no.

I would expect the semantics to behave as if

&lt;xsl:source-document href=&quot;x.html&quot; streamable=&quot;no&quot; use-accumulators=&quot;a b&quot;&gt;
   &lt;!--sequence constructor--&gt;
&lt;/xsl:source-document&gt;

is equivalent to:

&lt;xsl:source-document href=&quot;x.html&quot; streamable=&quot;yes&quot; use-accumulators=&quot;a b&quot;&gt;
   &lt;xsl:variable name=&quot;source&quot; select=&quot;copy-of(.)&quot; /&gt;
   &lt;xsl:for-each select=&quot;$source&quot;&gt;
      &lt;!--sequence constructor--&gt;
   &lt;/xsl:for-each&gt;
&lt;/xsl:source-document&gt;

This would work, because fn:copy-of on a streamed document copies its accumulators and disallows the use of any other accumulator. For non-streaming processors, it works because they are required to enforce the rule on copying and using applicable accumulators.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127291</commentid>
    <comment_count>1</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-09-04 11:45:16 +0000</bug_when>
    <thetext>If the proposal is accepted, we should also update the requirement that @use-accumulators only applies to streamed accumulators:

&quot;The value #all indicates that all accumulators that are visible in the containing package and declared with streamable=&quot;yes&quot; are applicable.&quot;

and:

&quot;Every EQName in the list must be the name of an accumulator, visible in the containing package, and declared with streamable=&quot;yes&quot;.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127331</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-07 22:55:29 +0000</bug_when>
    <thetext>I think there is a problem with making accumulators on unstreamed documents selectively applicable, which is that several instructions/functions can return the same document.

For example, if the stylesheet does

&lt;xsl:variable name=&quot;x&quot; select=&quot;doc(&apos;one.xml&apos;)&quot;/&gt;

and then does

&lt;xsl:source-document href=&apos;one.xml&apos; use-accumulators=&quot;a b c&quot;/&gt;

then I really don&apos;t want to have to keep two copies of the document one with accumulators and one without.

So I&apos;m inclined to stay with the principle that accumulators are selectively applicable to streamed documents, but universally applicable to unstreamed documents, despite the lack of orthogonality.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127335</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-09-08 08:34:56 +0000</bug_when>
    <thetext>Perhaps that is the way to go (re: comment#2), but how does that relate to the following? This example also requires keeping two copies around.

&lt;xsl:variable name=&quot;x&quot; select=&quot;doc(&apos;one.xml&apos;)&quot;/&gt;

&lt;xsl:template name=&quot;xsl:initial-template&quot;&gt;
   &lt;!-- applies accumulators selectively --&gt;
   &lt;xsl:source-document streamable=&quot;yes&quot; href=&apos;one.xml&apos; use-accumulators=&quot;a b c&quot;&gt;
      &lt;!-- copies accumulators, other accumulators are invalid --&gt;
      &lt;xsl:apply-templates select=&quot;copy-of(.)&quot; /&gt;
   &lt;/xsl:source-document&gt;
   &lt;!-- same document, but all accumulators are applicable --&gt;
   &lt;xsl:apply-templates select=&quot;$x&quot; /&gt;
&lt;/xsl:template&gt;

&lt;!-- matches only $x? --&gt;
&lt;xsl:template match=&quot;x[accumulator-before(&apos;foo&apos;) = &apos;test&apos;]&quot;&gt;
   &lt;xsl:value-of select=&quot;accumulator-after(&apos;bar&apos;)&quot; /&gt;
&lt;/xsl:template&gt;

&lt;!-- matches both $x and copy-of?--&gt;
&lt;xsl:template match=&quot;x[accumulator-before(&apos;a&apos;) = &apos;test&apos;]&quot;&gt;
   &lt;!-- error on copy-of, succeeds on $x? --&gt;
   &lt;xsl:value-of select=&quot;accumulator-after(&apos;bar&apos;)&quot; /&gt;
&lt;/xsl:template&gt;


The above is how the current rules are written up. That is, fn:copy-of() by default copies the accumulators and disallows other accumulators to apply.

Perhaps we could copy the accumulators of @use-accumulators, but at the same time allow non-streaming accumulators to apply to all non-streaming nodes?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127356</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-09 21:24:32 +0000</bug_when>
    <thetext>We decided that the use-accumulators attribute should apply to streamed as well as unstreamed documents.

These changes have been applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>