<?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>24497</bug_id>
          
          <creation_ts>2014-02-05 02:19:31 +0000</creation_ts>
          <short_desc>Missing posture and operands for streamability of xsl:merge</short_desc>
          <delta_ts>2014-05-15 14:00:28 +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>Windows NT</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>
          <dependson>24343</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abel Braaksma">abel.braaksma</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>cmsmcq</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>99728</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2014-02-05 02:19:31 +0000</bug_when>
    <thetext>Under 19.8.4.24 Streamability of xsl:merge (http://www.w3.org/TR/xslt-30/#streamability-xsl-merge), the posture is missing.

Also, it is not clear what the operands are for xsl:merge-source and whether xsl:merge-key is part of the operands.

The current rule seems to indicate that the following is allowed:

&lt;xsl:merge&gt;
   &lt;xsl:merge-source select=&quot;.&quot; &gt;
     &lt;xsl:merge-key select=&quot;foo&quot; /&gt;
   &lt;/xsl:merge-source&gt;
   &lt;xsl:merge-action&gt;
     &lt;xsl:copy-of select=&quot;.&quot; /&gt;
   &lt;/xsl:merge-action&gt;
&lt;/xsl:merge&gt;

Perhaps a bit senseless, and perhaps potentially streamable (I think it should not be streamable with the current rules), but I think we should at least name the operands. 

Also, I think we can do better here than only allowing motionless sources. I.e., when the for-each expression is absent or motionless and the select expression is consuming (or the reverse), and the merge-key is motionless, I think xsl:merge is streamable to the extend that merge-action is streamable. We might even go so far to consider xsl:merge streamable if the union of the select-expression is streamable, which would allow:

&lt;xsl:merge bind-key=&quot;grp&quot;&gt;
   &lt;xsl:merge-source select=&quot;foo&quot;&gt;
      &lt;xsl:merge-key select=&quot;@name&quot; /&gt;
   &lt;/xsl:merge-source&gt;
   &lt;xsl:merge-source select=&quot;bar&quot;&gt;
      &lt;xsl:merge-key select=&quot;@name&quot; /&gt;
   &lt;/xsl:merge-source&gt;
   &lt;xsl:merge-action&gt;
      &lt;xsl:value-of select=&quot;$grp&quot; /&gt;
   &lt;/xsl:merge-action&gt;
&lt;/xsl:merge&gt;

because the expression &quot;foo | bar&quot; is a streamable pattern, &quot;@name&quot; is motionless and the merge-action is consuming.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100276</commentid>
    <comment_count>1</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2014-02-11 13:49:18 +0000</bug_when>
    <thetext>We discussed this in Prague; the editor agrees that the current treatment is a bit cursory and will come back with a proposal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100974</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-02-20 17:19:21 +0000</bug_when>
    <thetext>I think we should keep this simple; doing a merge while we are already processing a streamed document is not a use case we need to pursue. So I think the rule should be:

* The xsl:merge instruction is grounded and motionless if every xsl:merge-source child element satisfies the following conditions:

** The for-each-item expression, if present, is grounded and motionless

** The for-each-stream expression, if present, is grounded and motionless

** If neither the for-each-item nor for-each-stream attribute is present, then the select expression is grounded and motionless

* Otherwise the xsl:merge instruction is roaming and free-ranging.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101837</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2014-03-04 16:15:22 +0000</bug_when>
    <thetext>Independently of each other, we seem to have written down the exact same rules ;), see bug 24343, comment#5, item 6.

I agree that we do not need to make the odd case of a merge action on the current streamed document streamable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102065</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-03-07 15:01:39 +0000</bug_when>
    <thetext>On 2014-03-06 the WG accepted the proposal in comment 2, subject to wording changes to improve readability.

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

    </bug>

</bugzilla>