Query with reused variables

<results>
 {
   let $doc := doc("prices.xml")
   for $t in distinct-values($doc/prices/book/title)
     let $p := $doc/prices/book[title = $t]/price
     return
       <minprice title="{$t}">
         { min($p) }
       </minprice>
 }
</results>

Adapted from XML Query Use Cases


Previous | Next | Top | Cafe con Leche | Cafe au Lait

Copyright 2002-2007 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified November 17, 2003