For each book in the bibliography, list the difference between the book's price and the average price, but this time indicate whether the book is more or less expensive than the average
<results>
{
let $doc := doc("bib.xml")
let $average := avg($doc//price)
for $b in $doc/bib/book
return
if ($b/price > $average) then
<data>
{ $b/title } is ${$b/price - $average}
more expensive than the average.
</data>
else
<data>
{ $b/title } is ${$average - $b/price}
less expensive than the average.
</data>
}
</results>