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