List titles of books published by Addison-Wesley
<bib>
FOR $b IN document("http://www.bn.com")/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("http://www.bn.com")/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