For each book found in both bib.xml and reveiws.xml, list the title of the book and its price from each source.
<books-with-prices>
{
FOR $b IN document("bib.xml")//book,
$a IN document("reviews.xml")//entry
WHERE $b/title = $a/title
RETURN
<book-with-prices>
{ $b/title },
<price-amazon> { $a/price/text() } </price-amazon>
<price-bn> { $b/price/text() } </price-bn>
</book-with-prices>
}
</books-with-prices>
Adapted from XML Query Use Cases