|
NOTE:
These slides have not been updated since 2003. They have been superseded by the book
Anders Møller and Michael Schwartzbach, February 2006 |
|
| THE XML REVOLUTION - TECHNOLOGIES FOR THE FUTURE WEB |
|
The following query lists each publisher and the average price of their books:
for $p in distinct-values(document("bib.xml")//publisher)
let $a := avg(document("bib.xml")//book[publisher = $p]/price)
return
<publisher>
<name>{ $p/text() }</name>
<avgprice>{ $a }</avgprice>
</publisher>
|
Compare this with the verbose XQueryX syntax.
|
| COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH |
|