Query with reused variables

<results>
 {
   FOR $t IN distinct(document("prices.xml")/book/title)
   LET $p := $doc/book[title = $t]/price
   RETURN
    <minprice title = { $t/text() } >
     { min($p) }
    </minprice>
 }
</results>

Adapted from XML Query Use Cases


Previous | Next | Top | Cafe con Leche

Copyright 2002 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified September 13, 2001