很麻烦,得用到递归<!-- Use: include this call with the number of iterations
This sample will loop from 1 to 10 including 1 and 10
-->
<xsl:call-template name="for.loop">
<xsl:with-param name="i">1</xsl:with-param>
<xsl:with-param name="count">10</xsl:with-param>
</xsl:call-template>
<!-- Rename "old name" elements to "new name" -->
<xsl:template name="for.loop">
<xsl:param name="i"/>
<xsl:param name="count"/>
<xsl:if test="$i &lt;= $count">
<!--    body of the loop goes here    -->
</xsl:if>
<xsl:if test="$i &lt;= $count">
<xsl:call-template name="for.loop">

<xsl:with-param name="i">
<!-- Increment index-->
<xsl:value-of select="$i + 1"/>
</xsl:with-param>
<xsl:with-param name="count">
<xsl:value-of select="$count"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>