[xquery-talk] Use of for in XQuery
per at bothner.com
Thu Jul 15 11:11:12 PDT 2004
> pl see the XQuery as follows :-
> let $a := doc ("boxes.xml")/boxes/box
> let $b := $a/length
> let $c := $a/breadth
> let $d := count ($a)
> let $area := ()
> for $i in (1 to $d) return
> sum (($area,$b[$i]*$c[$i]))
This is an unusual variation of Standard XQuery Beginner Confusion #1.
The function sun does *not* increment anything. It returns the sum
of the items in the argument.
XQuery does not have side-effects - once you've defined a variable,
it's value doesn't change.
per at bothner.com http://per.bothner.com/
More information about the talk