Re: [xsl] Recursion of variable

Subject: Re: [xsl] Recursion of variable
From: "watchstone@xxxxxxxxxxx" <watchstone@xxxxxxxxxxx>
Date: Tue, 16 Aug 2005 17:25:19 GMT
Thanks for your reply, David.  This was exactly what I asked for, but I realized after I tried to incorporate it, it doesn't 100% reflect the structure of my code.  Here's where I went wrong:

<cnt> only appears at the lowest level.  In the example, that would be at the <r3>, <r2> and <r1> levels respectively.  But I need to process each <r?> node because I need to copy additional nodes within them on output:  

<vector>
<r1>
<t>geometry</t>
<r2>
<t>parabola</t>
<r3>
<t>trapezium</t>
<cnt>4</cnt>
</r3>
<r3>
<t>rhombus</t>
<cnt>4</cnt>
</r3>
</r2>
<r2>
<t>parallelogram</t>
<cnt>3</cnt>
</r2>
</r1>
<r1>
<t>reflection</t>
<cnt>2</cnt>
</r1>
<r1>
<t>refraction</t>
<cnt>2</cnt>
</r1>
</vector>

Desired output:

<vector>
<r1>
<t>geometry</t>
<r2>
<t>parabola</t>
<r3>
<t>trapezium</t>
<o>1-5</o> (This is the value 1 + <cnt>, carry value "6" forward)
</r3>
<r3>
<t>rhombus</t>
<o>6-10</o> (This is the value 6 + <cnt>, carry value "11" forward)
</r3>
</r2>
<r2>
<t>parallelogram</t>
<o>11-14</o> (This is the value 11 + <cnt>, carry value "15" forward)
</r2>
</r1>
<r1>
<t>reflection</t>
<o>15-17</o> (This is the value 15 + <cnt>, carry value "18" forward)
</r1>
<r1>
<t>refraction</t>
<o>18-20</o> (This is the value 18 + <cnt>)
</r1>
</vector>

Current Thread