<?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>29160</bug_id>
          
          <creation_ts>2015-09-29 17:39:09 +0000</creation_ts>
          <short_desc>[XQ31] Obsolete Note under &quot;order by&quot;</short_desc>
          <delta_ts>2015-09-30 21:17:46 +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 3.1</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</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="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>josh.spiegel</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>123357</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-09-29 17:39:09 +0000</bug_when>
    <thetext>Section 3.11.8 ends with the obsolete Note:

Note:

Since the order by clause in a FLWOR expression is the only facility provided by XQuery for specifying a value ordering, a FLWOR expression must be used in some queries where iteration would not otherwise be necessary. For example, a list of books with price less than 100 might be obtained by a simple path expression such as $books/book[price &lt; 100]. But if these books are to be returned in alphabetic order by title, the query must be expressed as follows:

for $b in $books/book[price &lt; 100]
order by $b/title
return $b

This could be replaced by a new Note:

An alternative way of sorting is available from XQuery 3.1 using the fn:sort function. In previous versions of the language, a set of books might be sorted into alphabetic order by title using the FLWOR expression:

for $b in $books/book[price &lt; 100]
order by $b/title
return $b

In XQuery 3.1 the same effect could be achieved using the expression

$books/book
=&gt; filter(function($book){$book/price &lt; 100}) 
=&gt; sort(function($book){$book/title})</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123396</commentid>
    <comment_count>1</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2015-09-30 21:17:46 +0000</bug_when>
    <thetext>Fixed as suggested except for the second example I used:

  sort(
    $books/book[price &lt; 100],
    function($book){$book/title}
  )

Because introducing fn:filter appears unnecessary and I found it slightly distracting when comparing the examples.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>