1 Reply Latest reply on Feb 23, 2012 2:23 PM by odie_63

    Flexible FOR iteration in nested loop

      Hi everyone,
      I have a little challange with a FOR loop. A nested loop shall have a flexible iteration maximum that is calculated in the loop above. Till now, I get an exception for the use of variables in iteration header: {err}XP0006: "4 ({http://www.w3.org/2001/XMLSchema}decimal)": bad value for type {http://www.w3.org/2001/XMLSchema}integer

      My Code (shortend):

      for $loop1 at $loop1Count in $node1/node2
           for $loop2 at $loop2Count in $node2/node3
           let $IntervalSize := fn:round-half-to-even(abs($num1 div $num2), 0)
           for $IntervalLoop at $Count in 1 to *$IntervalSize*

      If I put an integer behind the variable "$IntervalSize" e.g. 3, than it works probably.
      Does someone know how to use the $IntervalSize as a maximum for the iteration count?

      Kind regards,
      S. Braendlin