List titles of books published by Addison-Wesley
<bib>
{
for $book in doc("bib.xml")/bib/book
where $book/publisher = "Addison-Wesley"
return
$book/title
}
</bib>
This where
clause could be replaced by an XPath predicate:
<bib>
{
for $book in doc("bib.xml")/bib/book[publisher="Addison-Wesley"]
return
$book/title
}
</bib>
But where
clauses can combine
multiple variables from multiple documents
Adapted from XML Query Use Cases