Re: Iteration in XSL

Subject: Re: Iteration in XSL
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Mon, 17 Jan 2000 17:14:46 +0100
You need to use recursivity.

For example :


---------- XML file : ----------
<?xml version='1.0' encoding='ISO-8859-1'?>

<index>4</index>
---------- XSL file : ----------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="index" name="index">
<xsl:param name="idx" select="normalize-space()"/>
<td>
<xsl:if test="$idx &gt; 0">
<xsl:call-template name="index">
<xsl:with-param name="idx" select="$idx - 1"/>
</xsl:call-template>
</xsl:if>
</td>
</xsl:template>


</xsl:stylesheet>
---------- result : ----------
<?xml version="1.0" encoding="utf-8"?>
<td><td><td><td><td/></td></td></td></td>
------------------------------

Hope this helps.

Eric

Martin Kupisch wrote:
> 
> Hi everyone,
> 
> currently I am working on connecting an XML-file with an XSL-file via
> LotusXSL to get an HTML-file. So far, so good. My problem is: in the
> HTML-file there is a table that needs conditional processing. Depending on
> an specific element value, e.g. <level>4</level>, I need to get table cells,
> <TD>. I.e., the value is 4, I would like to have 4 times <TD> in the result
> tree. So, as I cannot find a way of iteration in XSL, I would like to know
> if there is any chance of getting this achieved. Thanks for any suggestions
> !!
> Martin
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
------------------------------------------------------------------------
Eric van der Vlist                                              Dyomedea

http://www.dyomedea.com                          http://www.ducotede.com
------------------------------------------------------------------------


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread