Posted By

joaobarbosa on 10/15/11


Tagged

xslt Symphony


Versions (?)

Loop baseado em contador


 / Published in: XSLT
 

  1. <xsl:call-template name="loop">
  2. <xsl:with-param name="cycles" select="5"/>
  3. <xsl:with-param name="Tag" >td</xsl:with-param>
  4. </xsl:call-template>
  5.  
  6. <xsl:template name="loop">
  7. <xsl:param name="cycles" />
  8. <xsl:param name="Tag" />
  9.  
  10. <xsl:choose>
  11. <xsl:when test="number($cycles) &gt; 0">
  12.  
  13. <xsl:element name="{$Tag}">blank</xsl:element>
  14.  
  15. <xsl:call-template name="loop">
  16. <xsl:with-param name="cycles" select="number($cycles)-1" />
  17. <xsl:with-param name="Tag" >
  18. <xsl:value-of select="$Tag"/>
  19. </xsl:with-param>
  20. </xsl:call-template>
  21.  
  22. </xsl:when>
  23. </xsl:choose>
  24.  
  25. </xsl:template>

Report this snippet  

You need to login to post a comment.