This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17599 - [XQ31ReqUC] Dynamic sort order and collation for order by
Summary: [XQ31ReqUC] Dynamic sort order and collation for order by
Status: NEW
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Requirements for Future Versions (show other bugs)
Version: Working drafts
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Jim Melton
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-26 11:51 UTC by John Snelson
Modified: 2014-05-20 16:58 UTC (History)
2 users (show)

See Also:


Attachments

Description John Snelson 2012-06-26 11:51:17 UTC
It's often necessary to choose between sort order and collation used at runtime, especially when implementing a GUI - which typically has toggles for options like these. This is particularly hard to do right now, as the "order by" syntax has these as statically determined properties of the expression. One possible way tp do this currently is:

order by
  if($asc) then $i/title else () ascending,
  if($asc) then () else $i/title descending

It would be beneficial to allow an alternate form of "order by" that allows these properties to be specified at runtime.
Comment 1 Michael Kay 2012-06-26 12:09:20 UTC
Another way of achieving this, which would also have the benefit of adding a sort capability to XPath, would be a higher order sort() function, parameterized by either

(a) a function that computes the sort key, or

(b) a function that compares two items in the sequence to be sorted
Comment 2 Jonathan Robie 2014-05-20 16:58:55 UTC
Assigning to future requirements per Working Group decision (https://lists.w3.org/Archives/Member/w3c-xsl-query/2012Oct/0087.html).