[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Recursive attribute values

Subject: Recursive attribute values
From: "Kenny Bogoe (BogoeMD)" <kenny@xxxxxxxxx>
Date: Fri, 16 Jul 2004 16:47:17 +0200
xsl recursive
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.