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 23391 - [xslt 3.0] Streaming variables
Summary: [xslt 3.0] Streaming variables
Status: CLOSED WORKSFORME
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Working 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:
 
Reported: 2013-09-28 07:38 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2013-09-28 07:38:47 UTC
We carefully disallow binding of variables to nodes in a streamed document.

Except that we don't. We provide a workaround:

<xsl:for-each-group select="." group-adjacent="0" bind-group="var">

which is just another way of doing

<xsl:variable name="var" select="."/>

Having a variable bound to the streamed node is really useful in some contexts, e.g. inside xsl:analyze-string where the context item has been switched to a string. So people will undoubtedly use the workaround if we leave it open.

Now either grouping variables work, in which case we can use the same mechanisms to make ordinary streamed variables work; or they don't work, in which case we need to fix them.

I have a feeling that with the new "posture" mechanism, we can make streamed variables work. The essence of the solution is that the posture of a variable reference is the same as the posture of the initialising expression of the variable.
Comment 1 Michael Kay 2013-11-13 10:42:02 UTC
Related note (posted in email today):

The current rules for

for $v in S return R

are

	• If R is not grounded and motionless, then roaming and free-ranging.
	• Otherwise, the posture and sweep of S.

Firstly, rule 1 is ambiguous.The intended reading is (not(grounded and motionless)) rather than (not(grounded) and motionless).

But the requirement to be motionless seems unnecessary. It disallows, for example

for $x in product/copy(.) return $x/price - $x/discount

Secondly, the rule as written allows

for $x in 1 to 3 return child::product

which should not be streamable.

Assuming we don't pursue the idea of binding variables to streamed nodes (see bug 23391), I think the rules should be:

1. If R is not grounded, then roaming and free-ranging
2. Otherwise, the general streamability rules apply, where the two operands are:
   * S (usage navigation)
   * R (usage transmission, higher-order)
Comment 2 Michael Kay 2013-11-25 12:02:45 UTC
The Working Group examined this further (see email archive) and decided to make no change to the specification.