<?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>22933</bug_id>
          
          <creation_ts>2013-08-13 08:45:16 +0000</creation_ts>
          <short_desc>[XSLT 3.0] Streamability rules: Simple Mapping Expressions</short_desc>
          <delta_ts>2014-05-15 14:00:39 +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>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <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>91970</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-08-13 08:45:16 +0000</bug_when>
    <thetext>Since the streamability rules were written the XPath 3.0 grammar has changed so there is now a separate production for SimpleMapExpr. 

The semantics of a SimpleMapExpr are identical to the semantics of xsl:for-each, so it should be possible to use the same streamability rules without change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91972</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-08-13 10:01:42 +0000</bug_when>
    <thetext>&quot;Should be possible&quot; - indeed.

There is also a clear relationship to the rules for RelativePathExpr. This gives us an opportunity to examine why the rules for xsl:for-each and for RelativePathExpr are different. Let&apos;s look at the cases in turn.

1. For path expressions, we have the rule:

If either operand is a ContextItemExpr or a ForwardStep using the self axis, followed in either case by zero or more motionless predicates, then the sweep of the other operand;

which has no equivalent for xsl:for-each. It&apos;s very unlikely to arise with xsl:for-each, but does that mean we should leave it out? It certainly needs to be there for &quot;!&quot;.

2. For RelativePathExpr we have the rule

If the first operand is motionless, then motionless;

For xsl:for-each the corresponding rule has additional qualifications: the first relates to xsl:sort, which is a reasonable difference, and the second relates to the use of group binding variables. This qualification is also relevant to path expressions. However, I think it can be simplified.

I think there&apos;s another bug here. Consider the expression (1 to 10)/current(). The first operand is motionless so we deem the expression as a whole motionless, regardless of the fact that current() is free-ranging. The issue here is that there are a small number of constructs, including current(), current-group(), and references to group binding variables, that can appear on the rhs of &quot;/&quot; (or in the body of xsl:for-each) and depend on the &quot;outer context&quot; rather than the &quot;inner context&quot; of the expression.

So I think this rule for RelativePathExpr needs to disallow references to grouping variables and to current() on the rhs.

3. Under RelativePathExpr rule 3, we have:

If the syntactic context is an inspection context and the RelativePathExpr takes the form of a RelativePathExprP that itself conforms to the rules for a motionless pattern (see 19.3.10 Classifying Patterns), then consuming;

Clearly there&apos;s no direct equivalent for xsl:for-each because an xsl:for-each instruction cannot take the form of a pattern. It&apos;s an odd rule though, especially as the example given - exists(descendant::section) - isn&apos;t even a RelativePathExpr according to the way we defined it. Somehow one feels this rule shouldn&apos;t be necessary; it should fall out from the other rules.

4. Under xsl:for-each rule 3, we recognize group-consuming constructs of the form 

&lt;xsl:for-each select=&quot;$current-group&quot;&gt;&lt;xsl:value-of select=&quot;child&quot;/&gt;&lt;/xsl:for-each&gt;

We don&apos;t have any corresponding rule to recognize $current-group/string(child) as group-consuming; I can&apos;t see any good reason not to.

5. Rule 4 of RelativePathExpr and Rule 4 of xsl:for-each have similar effect but they are phrased differently and are not in fact equivalent. For example, the xsl:for-each rule recognizes 

&lt;xsl:for-each select=&quot;a/b/c&quot;&gt;&lt;xsl:sequence select=&quot;name()&quot;/&gt;&lt;/xsl:for-each&gt;

but the RelativePathExpr rule does not allow a/b/c/name(). I think these two rules should be aligned.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94836</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-10-16 14:29:46 +0000</bug_when>
    <thetext>The rewrite of the streamability rules following the Henley face-to-face means that this bug report is no longer relevant.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>