Looping on a maximum value

Subject: Looping on a maximum value
From: Brett McLaughlin <bmclaugh@xxxxxxxx>
Date: Wed, 22 Dec 1999 12:12:22 -0600
Suppose I have an XML fragment that looks something like:

<!-- Content -->

  <items>
   <item col="2">
    <name>Some Name</name>
    <content>Some Content</content>
   </item>
   <item col="4">
    <name>Some Other Name</name>
    <content>Some More Content</content>
   </item>
   <item col="3">
    <name>Some New Name</name>
    <content>Some Crazy Content</content>
   </item>
   <item col="2">
    <name>Some Guy's Name</name>
    <content>Some Content that is Different</content>
   </item>
  </items>

<!-- More Content -->

I want to do the equivalent of:

<!-- Get the highest column number and put it in an xsl variable called
numCols -->

<!-- Loop from 0 to that variable (numCols) - 1 [or 1 .. numCols] -->

  <xsl:apply-templates select="item[@col=counter]" />


Does that make sense?  Basically I need to get the number of columns I
will need, iterate from 1 to that number, and at each pass use the
counter to get all the items that specify that column as their col
attribute.

Thanks
Brett


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


Current Thread