XQuery按升序和降序排列

Tuf*_*y G 13 xml xquery

在XQuery中,您如何通过升序和降序进行排序?

我从教程中得到以下内容:

for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title
Run Code Online (Sandbox Code Playgroud)

可不可能是

for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title ascending
return $x/title
Run Code Online (Sandbox Code Playgroud)

Luc*_*ero 14

是的,您可以使用ascending(默认)或descendingorder by..表达式的末尾.

这是W3C XQuery规范相关部分的链接:

http://www.w3.org/TR/xquery/#doc-xquery-OrderSpec