Reputation: 123
I have the following XQuery:
let $a := 0
for $b in (1,2,3)
let $a := $a + 1
return $a+$b
The result I would expect is 2,4,6
However, the result is get is 2,3,4
Why does it produce this result, i.e. why does the value of $a in the for loop stays 1?
Upvotes: 1
Views: 437
Reputation: 11771
Variables in XQuery (and XSLT) are immutable. Therefore, once declared they cannot be reassigned.
Upvotes: 2