title: Remeber the last count of recursive call template within a for -each loop
body: <p>I have a XSLT maps that I use for some transformation. My problem is how can I remember the count 1.e; the number of times a loop has run. For example</p>
  
  <pre><code>&lt;xsl: for each&gt;  // This runs some 3 times
  
  &lt;xsl: call-template &gt; // This call template recursively runs 10 times
  &lt;xsl: with- param &gt;
  &lt;/xsl: call-template &gt;
  
  &lt;xsl: for each&gt;
  </code></pre>
  
  <p>In the above example outer for loop runs 3 times and inner call-template recurively call itself to print some thing suppose 10 times. So In all I have 3*10 = 30 cycles. </p>
  
  <p>What I need over here is suppose I have an intial number 001, When for loop runs first time it will call template that will recursively call itself 10 times. So  I printed numbers starting from 001 - 010 </p>
  
  <p>The next time I run the loop I again printed the numbers from 001-010 ans so on the third time. But What I want is to remember the last count. Suppose in first iteration I reached 010. So in second iteration I will start the count from 011 and print up to 021. 
  And in the third time I will print starting from 022-032.</p>
  
  <p>But can any one suggest me how can I do that ? How can I remember the last value up to which the printing is already done?</p>
  
  <p>And one more thing I'm actually limited to XSLT1.0. Thats the reason I have to loop like the example above.</p>
  
  <p>This would be a great help </p>
  
  <p>What I want to do is like this,
  Suppose I have an input xml as,</p>
  
  <pre><code>&lt;A&gt;
  
  &lt;B from="123456781" to="123456782"&gt;
  ........
  &lt;/B&gt;
  &lt;B from="123456781" to="123456785"&gt;
  ........
  &lt;/B&gt;
  &lt;B from="123456788" to="123456788"&gt;
  ........
  &lt;/B&gt;
  
  &lt;/A&gt;
  </code></pre>
  
  <p>In above xml each node B is associated with a range "from-to".  I need to create as many ouputB node as there is number in given range. and I also have to get unique count of each outputB node that is created. For example output xml can be like ,</p>
  
  <pre><code>&lt;root&gt;
  
  &lt;outputB value="123456781" id="001"&gt; // from first B node from="123456781" to="123456782"
  &lt;outputB value="123456782" id="002"&gt;
  
  &lt;outputB value="123456781" id="003"&gt;
  &lt;outputB value="123456782" id="004"&gt;// from second B node from="123456781" to="123456785"
  &lt;outputB value="123456783" id="005"&gt;
  &lt;outputB value="123456784" id="006"&gt;
  &lt;outputB value="123456785" id="007"&gt;
  
  &lt;outputB value="123456788" id="008"&gt;// from third B node from="123456788" to="123456788"
  
  &lt;/root&gt;
  </code></pre>
  
  <p>So In above xsl I have recursively populated on the basis of range values in from and to parameter while I have lopped bu for-each on each input B node. Thus creating the exact number of outputB nodes. But the problem here is maintaining unique count or id in generated xml.</p>
  
  <p>Thanks :)</p>