<?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>2921</bug_id>
          
          <creation_ts>2006-02-23 08:31:03 +0000</creation_ts>
          <short_desc>Provide an exemple of a numeric range used as filter epression</short_desc>
          <delta_ts>2006-03-14 23:35:09 +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>XQuery 1.0</component>
          <version>Candidate Recommendation</version>
          <rep_platform>All</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>P4</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Pierrick Brihaye">pierrick.brihaye</reporter>
          <assigned_to name="Don Chamberlin">chamberl</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>8398</commentid>
    <comment_count>0</comment_count>
    <who name="Pierrick Brihaye">pierrick.brihaye</who>
    <bug_when>2006-02-23 08:31:03 +0000</bug_when>
    <thetext>It would be nice to have an example for this commonly used kind of filter
expression :

$foo[(2 to 5)]

New users often tend to use a predicate-like syntax - $foo[2 to 5] - and thus
get syntax errors.

It would also be nice to add a reference to &quot;Filter expressions&quot; (3.3.2) in the
&quot;Predicates&quot; section (3.2.2). I don&apos;t know whether it should start with
&quot;warning&quot;, &quot;see also&quot;, &quot;do no confuse&quot;...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8404</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2006-02-23 09:59:42 +0000</bug_when>
    <thetext>$foo[(2 to 5)] is not a legal expression. It will give you a type error
FORG0006: se the rules for effective boolean value at
http://www.w3.org/TR/xpath20/#id-ebv, which are referred to from the rules for
predicates at http://www.w3.org/TR/xpath20/#id-predicates

There was an example of such a construct in a very early draft of XQuery back in
2001, but it never had any defined semantics.

You can achieve the desired effect by writing

$foo[position()=(2 to 5)]

or if you prefer, by

subsequence($foo, 2, 4)

Michael Kay
(personal response)
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8405</commentid>
    <comment_count>2</comment_count>
    <who name="Pierrick Brihaye">pierrick.brihaye</who>
    <bug_when>2006-02-23 10:15:52 +0000</bug_when>
    <thetext>Clean and clear answer.

I thus reformulate  : may the first example provided by Michael be added to the
specs ?

The comment about cross-referencing predicates and filter expressions still
stands although I now lean more an more towards &quot;warning&quot; semantics :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8723</commentid>
    <comment_count>3</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2006-03-14 23:34:56 +0000</bug_when>
    <thetext>Pierrick,
On 14 March 2006, the Query Working Group agreed to add the requested example to the explanation of predicates. Since this is an editorial suggestion that was accepted by the working group, I am marking this Bugzilla entry as Closed.
Regards,
Don Chamberlin (for the Query Working Group)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>