let
assigns a variable for reuse.
For each book in the bibliography, list the difference between the book's price and the average price:
<results>
{
let $doc := doc("bib.xml")
let $average := avg($doc//price)
for $b in $doc/bib/book
let $difference := $b/price - $average
return
<data>{ $b/title } is {$difference} more expensive than the average. </data>
}
</results>
:=
like Pascal, not =
like C and Java