<library>
<book>
<title>Introduction to XQuery</title>
<author>John Doe</author>
<price>29.99</price>
</book>
<book>
<title>XQuery and XPath Basics</title>
<author>Jane Smith</author>
<price>39.95</price>
</book>
<!-- 其他书籍... -->
</library>
1. 查询所有书籍的标题和作者:
for $book in doc("books.xml")//book
return concat("Title: ", $book/title, ", Author: ", $book/author)
输出: