[Xquery] How to do a increment in a For loop

Hello men.

How can i build a simple increment for $a by Xquery such as ?

let $a := 0
for $i in (1 to 10)
let $a := $a + 1
return $a

why a in this loop always is '1'

Thank you for reading, its will really helpful for my job if i can solve this problem :D:D

There are several ways to do this:

for a in $(seq 1 10); do
    echo $a
done

or

a=0
while [[ ${a} -le 10 ]]; do
    a=$(expr ${a} + 1)
done

or

a=0
while [[ ${a} -le 10 ]]; do
    (( a = a+ 1 ))
done

or ... any others?

hi i test by stylus studio 2010, your code not work at all. Is there some version of Xquery ?

I do apologize, I skipped right over the 'XQuery' requirement.