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 24455 - [xslt 3.0] Streamability of grouping variable references
Summary: [xslt 3.0] Streamability of grouping variable references
Status: CLOSED DUPLICATE of bug 24510
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: 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:
Blocks: 24556
  Show dependency treegraph
 
Reported: 2014-01-31 12:35 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2014-01-31 12:35:26 UTC
Consider:

<xsl:stream ...>
  <xsl:for-each-group select="/a/b/copy-of()" group-adjacent="c"
                      bind-group="g">
    <xsl:value-of select="$g/x"/>
    <xsl:value-of select="$g/y"/>
  </xsl:for-each-group>
</xsl:stream>

I get an error saying there are two downward selections ($g/x and $g/y)

This is because the variable reference $g is classified as consuming. See 19.8.7.10:

If all the following conditions are satisfied:
* V is a reference to a variable declared in a bind-group attribute of a containing xsl:for-each-group instruction F
* The path in the construct tree that connects V to the sequence constructor forming the body of F is such that no child construct is a higher-order operand of its parent
* The focus-setting container of V is F
then the sweep and posture of V are the sweep and posture of the select expression of F.

The select expression of xsl:for-each-group is grounded and consuming, so the variable reference is also considered grounded and consuming.

In fact, if the select expression is grounded, the grouping variable should be motionless.
Comment 1 Abel Braaksma 2014-02-11 08:30:46 UTC
So do you mean the variable reference gets the context posture set to the result posture of the select expression?
Comment 2 C. M. Sperberg-McQueen 2014-02-11 09:07:15 UTC
We discussed this on the second day of the Prague face to face meeting.  Some notes:

- The body of the for-each-group is not listed among the operands; we should add a note mentioning this, if only to avoid asking ourselves again in future whether that's a mistake.  (It's not:  the select is grounded, so nothing in the body can make a difference -- it could, if a variable from an outer for-each-group were allowed, but such variable references are disallowed by section 19.8.7.10 [the focus-setting container would be the inner for-each-group, which would violate 1c, 2c, or 3c].)

- The fact that the body is not among the (relevant) operands in this case means that the bug report is not in fact valid.  The for-each-group construct as a whole is adjudged grounded and consuming without ever needing to look at the body.  So the fact that the rules for variable reference would appear to rule this example out is made harmless:  those rules are not consulted for this case.

- Along the same lines, we are inclined to believe that the children of xsl:sort and the @group-adjacent attribute may also be ignorable in the case where the @select expression is grounded.  That would lead to a considerable simplification of the rules for this case (potential elimination of rules 1d, 1e, 1f in 19.8.4.18 Streamability of xsl:for-each-group).  Note that 1c must be retained, as the AVTs are evaluated with the outer focus, not the inner focus.

Although the original bug report appears to be INVALID, the other issues uncovered need resolution.
Comment 3 Michael Kay 2014-04-16 08:31:39 UTC
This problem appears to have been solved by virtue of the changes agreed under bug #24510. Therefore marking this as a duplicate.

*** This bug has been marked as a duplicate of bug 24510 ***