<?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>24109</bug_id>
          
          <creation_ts>2013-12-16 10:18:15 +0000</creation_ts>
          <short_desc>[xslt 3.0] streamability of xsl:variable when atomised</short_desc>
          <delta_ts>2014-05-15 14:00:29 +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>Last Call 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>
          <cc>abel.braaksma</cc>
          
          <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>97650</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-12-16 10:18:15 +0000</bug_when>
    <thetext>(Reported by John Lumley)

The following template is deemed non-streamable under current rules:

   &lt;xsl:template match=&quot;your:extra&quot; mode=&quot;s&quot; xmlns:your=&quot;http://your.com/ns&quot;&gt;
     &lt;extra&gt;
       &lt;xsl:variable name=&quot;n&quot; as=&quot;xs:integer&quot; select=&quot;.&quot;/&gt;
       &lt;xsl:value-of select=&quot;$n gt 20&quot;/&gt;
     &lt;/extra&gt;
   &lt;/xsl:template&gt;

The analysis fails to take into account that the as=&quot;xs:integer&quot; ensures the context item is atomized, and the usage should therefore be absorption. The concept of &quot;type-determined usage&quot; should come into this somehow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98355</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-01-13 20:31:55 +0000</bug_when>
    <thetext>More specifically:

For the select attribute, the operand usage is type-determined if there is an &quot;as&quot; attribute, or navigation otherwise.

For the contained sequence constructor, the operand usage is type-determined if there is an &quot;as&quot; attribute, or absorption otherwise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98639</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-01-16 17:48:20 +0000</bug_when>
    <thetext>The WG accepted the proposed change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101978</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2014-03-06 14:00:55 +0000</bug_when>
    <thetext>I am reopening this, because it seems the change introduced a new bug.

Under 19.8.4.39, under the rules, list item 2.b., the usage of the seqtor operand has changed from navigation (previous draft) to absorption (current internal draft).

This would allow the following to be streamable (sequence has usage transmission, seqtor usage absorption):

&lt;xsl:variable name=&quot;x&quot;&gt;
    &lt;xsl:sequence select=&quot;foo&quot;&gt;
&lt;/xsl:variable&gt;

but it isn&apos;t streamable, because the variable would hold a reference to a streamed node.

Unless I misunderstand the change, I think the proper usage here is navigation, and not absorption.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101989</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-03-06 16:47:10 +0000</bug_when>
    <thetext>I think it was correct as written. In your example

&lt;xsl:variable name=&quot;x&quot;&gt;
    &lt;xsl:sequence select=&quot;foo&quot;&gt;
&lt;/xsl:variable&gt;

the value of the variable $x is a document node containing a copy of foo, it&apos;s not a reference to the original foo node.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102027</commentid>
    <comment_count>5</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2014-03-06 23:14:13 +0000</bug_when>
    <thetext>Indeed, it appears I got confused with the same rule for xsl:template, actually, I often make this mistake with xsl:variable.

In which case, the previous WD was incorrect (having usage navigation) and the new draft fixed that. Thanks for the explanation.

I think the bug can be closed again ;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103945</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-04-16 08:21:35 +0000</bug_when>
    <thetext>Closed again with no action, as suggested in comment #5.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>