title: Iterate through every node in a XML
body: <p>Hi
  I am trying to iterate through every node in a xml, be it the element node, text node or comment. With the below XSL in the very first statement 
  prints the complete xml. How do i copy the very first node in $nodes and call the template process-nodes again removing teh first node in my next iteration?</p>
  
  <pre><code>&lt;?xml version='1.0'?&gt;
  &lt;xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
  &lt;xsl:call-template name="process-nodes"&gt;
  &lt;xsl:with-param name="nodes" select="//node()" as="node()*"/&gt;
  &lt;/xsl:call-template&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template name="process-nodes"&gt;
  &lt;xsl:param name="nodes" as="node()*" /&gt;
  &lt;xsl:copy-of select="$nodes[1]"/&gt;
  &lt;xsl:if test="$nodes"&gt;
      &lt;xsl:call-template name="process-nodes"&gt;
        &lt;xsl:with-param name="nodes"
          select="remove($nodes, 1)" /&gt;
      &lt;/xsl:call-template&gt;
  &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Note: I am looking for fixing the issue in this kind of implementation rather than changing the template match to   <code>&lt;xsl:template match="@* | node()"&gt;</code>  as I need to have some processing which requires this approach.</p>
  
  <p>Thanks.</p>