This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24497 - Missing posture and operands for streamability of xsl:merge
Summary: Missing posture and operands for streamability of xsl:merge
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on: 24343
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-05 02:19 UTC by Abel Braaksma
Modified: 2014-05-15 14:00 UTC (History)
1 user (show)

See Also:


Attachments

Description Abel Braaksma 2014-02-05 02:19:31 UTC
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:

<xsl:merge>
   <xsl:merge-source select="." >
     <xsl:merge-key select="foo" />
   </xsl:merge-source>
   <xsl:merge-action>
     <xsl:copy-of select="." />
   </xsl:merge-action>
</xsl:merge>

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:

<xsl:merge bind-key="grp">
   <xsl:merge-source select="foo">
      <xsl:merge-key select="@name" />
   </xsl:merge-source>
   <xsl:merge-source select="bar">
      <xsl:merge-key select="@name" />
   </xsl:merge-source>
   <xsl:merge-action>
      <xsl:value-of select="$grp" />
   </xsl:merge-action>
</xsl:merge>

because the expression "foo | bar" is a streamable pattern, "@name" is motionless and the merge-action is consuming.
Comment 1 C. M. Sperberg-McQueen 2014-02-11 13:49:18 UTC
We discussed this in Prague; the editor agrees that the current treatment is a bit cursory and will come back with a proposal.
Comment 2 Michael Kay 2014-02-20 17:19:21 UTC
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.
Comment 3 Abel Braaksma 2014-03-04 16:15:22 UTC
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.
Comment 4 Michael Kay 2014-03-07 15:01:39 UTC
On 2014-03-06 the WG accepted the proposal in comment 2, subject to wording changes to improve readability.

The changes have been applied.