List the titles of books published by Morgan Kaufmann in 1998.
for $b in document("bib.xml")//book where $b/publisher = "Morgan Kaufmann" and $b/year = "1998" return { $b/title }
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 <publisher> <name> { $p/text() } </name> <avgprice> { $a } </avgprice> </publisher>