[xquery-talk] Results from previous iterations

Vyacheslav Zholudev vyacheslav.zholudev at gmail.com
Wed Nov 10 00:57:59 PST 2010


Hi all,

probably a simple question, but playing around didn't bring me any positive results.

My intention is to pass the result of a particular iteration of a for loop to the next iteration, sth, like


   let $val := 1 return
   for $i in 1 to 10 return
    let $val := local:plus-one($val) return $val

where local:plus-one increments the value by 1. So the desired results would be (2, 3, 4..., 10), but in practice of course (2,2,2...,2)

I know that it's against the "side-effect free" design in XQuery, but are there any common patterns to simulate something like this?

Thanks a lot in advance!

Vyacheslav



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20101110/1a44b8e0/attachment.htm


More information about the talk mailing list