[xquery-talk] Use of for in XQuery
amitabhojha at rediffmail.com
Thu Jul 15 17:46:18 PDT 2004
An HTML attachment was scrubbed...
-------------- next part --------------
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
The xml document is as follows :-
As u would have guessed, I wish to summate the length*breadth for all boxes. But when I apply the above Xquery, for each iteration of the for statement, the $area is being taken as () even as I expect it to increment each time. The other thing is that I wish to first let the for statement do the summation and then finally I let return statement execute just once giving the sum. Right now, the return statement executes with each iteration of for (each time taking $area as () ) and I am unable to stop that : I just wish one final summation result.
Will be grateful for any advice/ help on this.
More information about the talk