xsl-list
[Top] [All Lists]

RE: Recursive attribute values

2004-07-16 08:18:42
try

<xsl:attribute name="t">
  <xsl:value-of select="floor($y div $top)"/>
</xsl:attribute>

Michael Kay

-----Original Message-----
From: Kenny Bogoe (BogoeMD) [mailto:kenny(_at_)bogoe(_dot_)com] 
Sent: 16 July 2004 15:47
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Recursive attribute values

Hi,

I am using this recursive template to generate N elements on 
the fly and it
works perfect, but I also need to generate dynamic values for 
attribute "t"
based on the variable $top. I have been experimenting a lot, 
but the result
is always the same attribute value for all generated 
elements. As you can
see in my output sample below the "t" value is changing every 
$top. Anyone
know how to do this?


<xsl:attribute-set name="td">
<xsl:attribute name="w">1</xsl:attribute>
<xsl:attribute name="h">1</xsl:attribute>
</xsl:attribute-set>

<xsl:variable name="top">3</xsl:variable>

<xsl:template name="td">
   <xsl:param name="x"/>
   <xsl:param name="y"/>

<xsl:element name="td" use-attribute-sets="td">
        <xsl:attribute name="l"><xsl:value-of 
select="$y"/></xsl:attribute>
        <xsl:attribute name="t"><!--VALUES IS MISSING
HERE--></xsl:attribute>
</xsl:element>
   
   <xsl:if test="$x > 1">
    <xsl:call-template name="td">
     <xsl:with-param name="x" select="$x - 1"/>
     <xsl:with-param name="y" select="$y + 1"/>

    </xsl:call-template>
   </xsl:if>
</xsl:template>


This output I need ($top is determine the repetition of "t"):

<td w="1" h="1" l="0" t="0"/>
<td w="1" h="1" l="0" t="0"/>
<td w="1" h="1" l="0" t="0"/>
<td w="1" h="1" l="0" t="1"/>
<td w="1" h="1" l="0" t="1"/>
<td w="1" h="1" l="0" t="1"/>
<td w="1" h="1" l="0" t="2"/>
<td w="1" h="1" l="0" t="2"/>
<td w="1" h="1" l="0" t="2"/>
Etc.

Thanks in advance
Kenny Bogoe




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>