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

Re: Generate N elements and attribute values

Subject: Re: Generate N elements and attribute values
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Jul 2004 16:14:26 -0400
generate name
Hi Kenny,

Presumably the recursive template that creates the three td elements is inside the template that creates the tr elements. (I don't know how else you'd do it. ;-)

If so, each time the "inner" template is called (by an iteration of the "outer" template), you can pass a parameter through to carry the count of the outer iteration.

Does that make sense?

<xsl:template name="outer">
  <xsl:param name="count" select="0"/>
  ....
  <xsl:call-template name="inner">
    <xsl:with-param name="outer-count" select="$count"/>
  </xsl:call-template>
  <xsl:if test="$count &lt; $max-count)">
    <xsl:call-template name="outer">
      <xsl:with-param name="count" select="$count + 1"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

I hope I understood the question....

Cheers,
Wendell

At 02:50 PM 7/16/2004, you wrote:
I have already posted a question on how to generate dynamic attribute values
within a recursive template, but I have to admit that I got a bit confused
when reading my own posting, so I retry with a simplified version of my
problem.

A recursive template is generating N=4 <tr> and another inline recursive
template is generating n=3 <td> and so far I have no problems. But when it
comes to the attribute values of <td name="?"/> I really do not know what to
do since the @name of <td> is generated on the fly and after all <tr> are
generated. As shown in the result tree below the @name of <td> always
follows the @no of <tr>.

So my simple question is how to generate @name values on the fly?


This is the result tree I need:


<tr no="0">
    <td name="0"/>
    <td name="0"/>
    <td name="0"/>
</tr>
<tr no="1">
    <td name="1"/>
    <td name="1"/>
    <td name="1"/>
</tr>
<tr no="2">
    <td name="2"/>
    <td name="2"/>
    <td name="2"/>
</tr>
<tr no="3">
    <td name="3"/>
    <td name="3"/>
    <td name="3"/>
</tr>


Thanks, Kenny Bogoe


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

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.