XSL中循环的实现

来源:互联网 发布:易语言盗号软件源码 编辑:程序博客网 时间:2024/05/21 12:49

<xsl:template match="/">
  <xsl:call-template name="loop">
    <xsl:with-param name="Count">5</xsl:with-param>
  </xsl:call-template>
</xsl:template>

<xsl:template name="loop">
  <xsl:param name="Count"/>
  <xsl:if test="$Count&lt;1"><xsl:value-of select="'finish'"/></xsl:if>
  <xsl:if test="$Count&gt;=1">
    <xsl:value-of select="$Count"/>
    <xsl:call-template name="loop">
      <xsl:with-param name="Count"><xsl:value-of select="number($Count)-1"/></xsl:with-param>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

原创粉丝点击