This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Repetition without a repeated source node
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: Repetition without a repeated source node
- From: Mike Brown <mbrown at corp dot webb dot net>
- Date: Tue, 29 Feb 2000 19:42:28 -0700
- Cc: "'james at mirronex dot com'" <james at mirronex dot com>
- Reply-To: xsl-list at mulberrytech dot com
James Kerr wrote:
> I have an XML document that has a number as one of its attributes. I
> would like to use that number as input into a loop and output
> a block of HTML code the specified number of times.
In one template, do this...
<xsl:call-template name="MakeHTMLBlock">
<xsl:with-param name="num" select="number(@foo)"/>
</xsl:call-template>
And then have this template...
<xsl:template name="MakeHTMLBlock">
<xsl:param name="num"/>
<xsl:if test="$num">
<p>
<b>some HTML</b>
</p>
<xsl:call-template name="MakeHTMLBlock">
<xsl:with-param name="num" select="$num - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list