<?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>26606</bug_id>
          
          <creation_ts>2014-08-19 08:39:26 +0000</creation_ts>
          <short_desc>XT3TS: bug-1701</short_desc>
          <delta_ts>2015-05-06 21:16:21 +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 Test Suite</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</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="Tim Mills">tim</reporter>
          <assigned_to name="Abel Braaksma">abel.online</assigned_to>
          <cc>abel.braaksma</cc>
    
    <cc>mike</cc>
          
          <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>110286</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-08-19 08:39:26 +0000</bug_when>
    <thetext>The result of this test depends on the order of evaluation.

e.g. in

        &lt;xsl:variable name=&quot;won&quot; 
            select=&quot;count($matches[team=$this][number(team[.=$this]/@score) &amp;gt; number(team[.!=$this]/@score)])&quot;/&gt;

A processor is free to reorder the predicates.  Doing so can result in a type check error in the call to number().

Quoting XPath 3.0:

&quot;The expression in the following example cannot raise a casting error if it is evaluated exactly as written (i.e., left to right). Since neither predicate depends on the context position, an implementation might choose to reorder the predicates to achieve better performance (for example, by taking advantage of an index). This reordering could cause the expression to raise an error.

$N[@x castable as xs:date][xs:date(@x) gt xs:date(&quot;2000-01-01&quot;)]

To avoid unexpected errors caused by expression rewrite, tests that are designed to prevent dynamic errors should be expressed using conditional expressions. For example, the above expression can be written as follows:

$N[if (@x castable as xs:date)
   then xs:date(@x) gt xs:date(&quot;2000-01-01&quot;)
   else false()]&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110287</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-08-19 10:16:01 +0000</bug_when>
    <thetext>Yuk, I always hated that rule, which was put in the spec for the benefit of implementors who want to translate XPath into SQL (and certainly not for the benefit of users). But it&apos;s there, so I guess we have to live with it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118724</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-03-20 15:13:21 +0000</bug_when>
    <thetext>Now fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120173</commentid>
    <comment_count>3</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2015-05-06 21:16:21 +0000</bug_when>
    <thetext>Was resolved &gt; 30 days ago, closing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>