RE: [xsl] Iterative variation of attributes

Subject: RE: [xsl] Iterative variation of attributes
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 3 Mar 2004 14:43:31 +0200
Hi,

>  I have a template like this... 
> 
>  <xsl:template name="dibujaEje">
>   
>   <line x1="16%" y1="85%" x2="16%" y2="15%"/>
>   <line x1="17%" y1="85%" x2="17%" y2="15%"/>
>    :    :             :                :
>   <line x1="84%" y1="85%" x2="84%" y2="15%"/>
>   <line x1="85%" y1="85%" x2="85%" y2="15%"/>
> 
>  </xsl:template>
> 
>  
>  The attributes of the element line, x1 and x2 change from 
> 16% to 85%...
> 
>  How i could simplify this and haven't to write all the lines?¿?

  <xsl:template name="dibujaEje">
    <xsl:param name="start" select="15"/>
    <xsl:param name="end" select="85"/>
    <xsl:param name="current" select="$start"/>
    <xsl:if test="$current &lt;= $end">
      <line x1="{$current}%" y1="{$end}%" x2="{$current}%" y2="{$start}%"/>
      <xsl:call-template name="dibujaEje">
        <xsl:with-param name="start" select="$start"/>
        <xsl:with-param name="end" select="$end"/>
        <xsl:with-param name="current" select="$current + 1"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

Cheers,

Jarno - Chris C: Vengeance Is Mine

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


Current Thread