<?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>22937</bug_id>
          
          <creation_ts>2013-08-13 11:49:42 +0000</creation_ts>
          <short_desc>[xslt 3.0] Rules for streamable patterns</short_desc>
          <delta_ts>2014-05-15 14:00:38 +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>91977</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-08-13 11:49:42 +0000</bug_when>
    <thetext>The rules for motionless patterns in 19.3.10 say:

(a) The expression in the predicate must be motionless.

(b) The predicate must not contain a call on either of the functions position or last.

Now, the second condition is not complete, because we must also eliminate indirect calls via named function references or function-lookup().

Also, the second condition is stricter than it needs to be. For example, it disallows a pattern such as

match=&quot;p[. = $special[last()]]&quot;

And perhaps the second condition is redundant?

Certainly the ban on last() appears redundant, because if the expression contains a call on last() other than one masked as in this example, then it will not be a motionless expression (last() is free-ranging). But calls to position() are allowed in a motionless expression. For clarity, it seems best to ignore the partial redundancy and leave the ban on position() in place.

So I propose to change rule (b) to:

(b) The predicate must not contain any of the following, unless it occurs within a nested predicate:

(i) A function call to position, last, or function-lookup
(ii) A named function reference that references position, last, or function-lookup

I would propose to make the meaning of &quot;nested predicate&quot; clear by means of examples; and then add a Note to say that the ban on last() is redundant.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91978</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-08-13 11:53:20 +0000</bug_when>
    <thetext>I also propose to refine the rules for expressions that return booleans as follows:

(a) allow a return type of S where S satisfies subtype(S, xs:boolean?) - which allows subtypes of xs:boolean as well as xs:boolean itself

(b) allow &quot;treat as xs:boolean&quot; - again allowing subtypes

I wonder whether we should also allow expressions that are statically known to return nodes? For example it seems unreasonable to disallow

match=&quot;p[@status]&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>92087</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-08-15 11:02:14 +0000</bug_when>
    <thetext>I have (subject to WG approval) extended the rules to allow in predicates all expressions where relatively simple type analysis shows them to be non-numeric. This therefore allows patterns such as 

p[@class]
p[@class|@style]
p[substring-after(@class,&apos;:&apos;)]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93652</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-09-23 16:16:52 +0000</bug_when>
    <thetext>The changes described here have been applied to the spec.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>