I’ve got a problem running Q12 from http://www.w3.org/TR/xquery/
# XQuery 1.0: (Q12) List each publisher and the average price of its books.
FOR $p IN distinct(document(“bib.xml”)//publisher)
LET $a := avg(document(“bib.xml”)//book[publisher = $p]/price)
RETURN
{$p/text()}
{$a}
The avg function produces an 0 when a price element contains a decimal value (for example 45.99). Is this an “unlisted limitation” or (…)?
Sample output:
xql:result
PTR PH
0
Addison Wesley
63
</xql:result>