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 24109 - [xslt 3.0] streamability of xsl:variable when atomised
Summary: [xslt 3.0] streamability of xsl:variable when atomised
Status: CLOSED FIXED
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:
 
Reported: 2013-12-16 10:18 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2013-12-16 10:18:15 UTC
(Reported by John Lumley)

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

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

The analysis fails to take into account that the as="xs:integer" ensures the context item is atomized, and the usage should therefore be absorption. The concept of "type-determined usage" should come into this somehow.
Comment 1 Michael Kay 2014-01-13 20:31:55 UTC
More specifically:

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

For the contained sequence constructor, the operand usage is type-determined if there is an "as" attribute, or absorption otherwise.
Comment 2 Michael Kay 2014-01-16 17:48:20 UTC
The WG accepted the proposed change.
Comment 3 Abel Braaksma 2014-03-06 14:00:55 UTC
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):

<xsl:variable name="x">
    <xsl:sequence select="foo">
</xsl:variable>

but it isn'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.
Comment 4 Michael Kay 2014-03-06 16:47:10 UTC
I think it was correct as written. In your example

<xsl:variable name="x">
    <xsl:sequence select="foo">
</xsl:variable>

the value of the variable $x is a document node containing a copy of foo, it's not a reference to the original foo node.
Comment 5 Abel Braaksma 2014-03-06 23:14:13 UTC
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 ;).
Comment 6 Michael Kay 2014-04-16 08:21:35 UTC
Closed again with no action, as suggested in comment #5.