[xsl] Recursion of variable

Subject: [xsl] Recursion of variable
From: "watchstone@xxxxxxxxxxx" <watchstone@xxxxxxxxxxx>
Date: Mon, 15 Aug 2005 21:24:40 GMT
I have code in the following hierarchical structure.  I want to print out a range of numbers for each <r?> node processed (starting from number 1) See desired output below.  The value of <cnt> is used as an incremental number.  That number + 1 will be used as the starting value for the next r? node. Sometimes there will only be items at the r1 level and there won't be child r2, r3 etc. levels.  I can't seem to make this work.  

<r1>
<cnt>8</cnt>
<r2>
<cnt>6</cnt>
<r3>
<cnt>4</cnt>
</r3>
<r3>
<cnt>4</cnt>
</r3>
</r2>
<r2>
<cnt>3</cnt>
</r2>
</r1>
<r1><cnt>2</cnt></r1>
<r1><cnt>2</cnt></r1>

Desired output:

<o>1-9</o> (<r1>; 1 + <cnt> (8), carry "10" forward for processing of next <r?> node)
<o>10-16</o> (<r2>; 10 + <cnt> (6), carry "17" forward for process of next <r?> node )
<o>17-21</o> (<r3>; 17 + <cnt> (4) carry "22" forward for processing of next <r?> node)
<o>22-26</o> (<r3>; 22 + <cnt> (4) carry "27" forward for processing of next <r?> node)
<o>27-30</o> (<r2>; 27 + <cnt> (3) carry "31" forward for processing of next <r?> node)
<o>31-33</o> (<r1>; 31+ <cnt> (2) carry "34" forward for processing of next <r?> node)
<o>34-36</o> (<r1>; 34 + <cnt> (2) no more nodes to process)

Thanks for you help.  I have no hair left as I have pulled all two of them out. :)

W

Current Thread