Lainaus Dionisio Ruiz de Zarate <dionisio(_at_)tinieblas(_dot_)com>:
<!-- hello
<!-- into oe xml i have:
<!--
<!-- <nofrows>10</nofrows>
<!-- the nofrows value is variable.
<!--
<!-- how can i ade one thing as this using xsl:
<!--
<!-- for(i=0;i<nofrows;i++){
<!-- here print <td><xsl:value-of="xxx"/></td>
<!-- }
<!--
<!-- how can i print one <td></td> nofrows times.
<!--
<!--
<!-- canyou help me?
<!-- thanks
You have to use recursion / call-template something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:variable name="times">10</xsl:variable>
<xsl:call-template name="loop">
<xsl:with-param name="start-val" select="'1'"/>
<xsl:with-param name="end-val" select="$times"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="loop">
<xsl:param name="start-val"/>
<xsl:param name="end-val"/>
<xsl:param name="increment" select="'1'"/>
<xsl:if test="$start-val <= $end-val">
<!-- do stuff here, i just print out the number -->
VALUE: <xsl:value-of select="$start-val"/>
<!-- recurse -->
<xsl:call-template name="loop">
<xsl:with-param name="start-val" select="$start-val +
$increment"/>
<xsl:with-param name="increment" select="$increment"/>
<xsl:with-param name="end-val" select="$end-val"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
***************************************************
* Jarkko Moilanen *
* Project Manager, ITCM (www.itcm.org) *
* Profound XML technology Expert *
* University of Tampere *
* Hypermedia Laboratory *
***************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list