XQuery FLWOR 表达式

时间:2024-04-14 14:03:31

FLWOR 是 "For, Let, Where, Order by, Return" 的只取首字母缩写。
for 语句把 bookstore 元素下的所有 book 元素提取到名为 $x 的变量中。
where 语句选取了 price 元素值大于 30 的 book 元素。
order by 语句定义了排序次序。将根据 title 元素进行排序。
return 语句规定返回什么内容。在此返回的是 title 元素。

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