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

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
Looping on a maximum value
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

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.