This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: finite loop, incrementing, or...?
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: finite loop, incrementing, or...?
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Thu, 3 Feb 2000 10:12:17 -0000
- Reply-To: xsl-list at mulberrytech dot com
> <tscmeta>
> <frequency code="ANNUAL" />
> <date year="1994" month="1" day="1" />
> <date year="1998" month="12" day="31" />
> </tscmeta>
>
> Desired output:
> <table><tr><td>1994</td><td>1995</td><td>1996</td><td>1997</td
> ><td>1998</td>
> </tr></table>
>
> Any solutions?
There's a nice little extension function coming out in the next Saxon
release that will allow you to do
<table><tr>
<xsl:for-each select="s:range(date[1]/@year, date[2]/@year)">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr></table>
Meanwhile it has to be recursion. The principle is:
template do-range
param from
param to
if $from<=$to
<td><value-of $from></td>
call-template do-range
with-param from = $from+1
with-param to = $to
/call
/if
/template
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list