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

Re: counting?

Subject: Re: counting?
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 21 Nov 2000 15:56:57 -0700 (MST)
jason russ
Jason Russ wrote:
> I would like to count the number of
> iterations in a for-each loop (used to
> create a table) and add in a new tag
> (to create a new table) every 15th iteration.
> 
> How do I go about counting and checking
> for the 15th iteration in XSL?

You don't. And you don't add in 'tags' either. This is a FAQ.
See http://www.dpawson.co.uk/

Iterate through every 15th node, then for each of those, create a new
table element. This should get you started:

<xsl:variable name="someNodes" select="path/to/some/nodes"/>
<xsl:for-each select="$someNodes[position() mod 15 = 1]">
  <!-- current node is now the 1st, 16th, 31st... from $someNodes -->
  <table>
   ...
  </table>
</xsl:for-each>

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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


Current Thread
  • counting?
    • Jason Russ - Tue, 21 Nov 2000 17:08:35 -0500
      • Wendell Piez - Tue, 21 Nov 2000 17:34:28 +0000
      • Mike Brown - Tue, 21 Nov 2000 15:56:57 -0700 (MST) <=
      • <Possible follow-ups>
      • Kay Michael - Wed, 22 Nov 2000 11:33:07 -0000

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.