title: Xslt Looping using xsl:variable
body: <p>I wanted to use xsl:variable and loop based on it's count, but I am not sure if its possible in Xslt. for example if I have a variable name count</p>
  
  <pre><code>&lt;xsl:variable name="count" as="xs:integer" select="4"/&gt;
  </code></pre>
  
  <p>Can I make use of variable, in below form!!!</p>
  
  <pre><code>&lt;xsl:if test="some condition"/&gt;
  loop from 0 to $count
  ...do something here
  end loop
  &lt;/xsl:if&gt;
  </code></pre>
  
  <p>Is it possible?</p>
  
  <p>My Input XML:</p>
  
  <pre><code>&lt;Root&gt;
  &lt;Element&gt;
      &lt;Value&gt;1&lt;/Value&gt;
      &lt;Value&gt;2&lt;/Value&gt;
  &lt;/Element&gt;
  &lt;Element&gt;
      &lt;Value&gt;1&lt;/Value&gt;
      &lt;Value&gt;2&lt;/Value&gt;
      &lt;Value&gt;3&lt;/Value&gt;
      &lt;Value&gt;4&lt;/Value&gt;
  &lt;/Element&gt;
      &lt;Element&gt;
      &lt;Value&gt;1&lt;/Value&gt;
  &lt;/Element&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>Expected output in flat file is (with line-breaks):</p>
  
  <pre><code>1,2,,
  1,2,3,4
  1,,,
  </code></pre>
  
  <p>Any help appreciated. Thanks Mh.</p>