[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Creating a number new nodes in a tree based upon a numeric value


Subject: Re: [xsl] Creating a number new nodes in a tree based upon a numeric value
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 09 Jan 2001 14:10:30 +0000

Robert,

Another way to do this is to fake a loop using the nefarious <xsl:for-each> ....

<xsl:template match="TAG">
  <TABLE>
    <TR ID="@ID">
      <xsl:for-each select="//*[position() &lt;= @Value]">
        <TD></TD>
      </xsl:for-each>
    </TR>
  </TABLE>
</xsl:template>

Of course, this is a truly horrible departure from the True Way and I'd have to report to the authorities anyone I discovered doing it. (Not only is it unconscionable heresy; it only works if the value of @Value never gets higher than the total number of nodes in your source document.)

Cheers,
Wendell

</xsl:template>At 06:14 PM 1/8/01 -0800, you wrote:

Ok, I think the answer is "no", but I'm still curious to ask.

Say I have an XML doc that contains something like:

 <Tag ID="1">
   <Value>4</Value>
 </Tag>
 <Tag ID="2">
   <Value>2</Value>
 </Tag>

... and I want to end up with something like:

<TABLE>
 <TR ID="1">
   <TD></TD>
   <TD></TD>
   <TD></TD>
   <TD></TD>
 </TR>
</TABLE>
<TABLE>
 <TR ID="2">
   <TD></TD>
   <TD></TD>
 </TR>
</TABLE>

====================================================================== 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 ======================================================================


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




Current Thread
Keywords
xml