|
Code Listing 2: Book price query, reordered by price
<books-with-prices>
{
for $b in document("http://www.bn.com/bib.xml")//book,
$a in document("http://www.amazon.com/reviews.xml")//entry
where $b/title = $a/title
order by min(($a|$b)/price) {-- new addition --}
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>
|