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

Re: for-each question

Subject: Re: for-each question
From: Mike Brown <mike@xxxxxxxx>
Date: Fri, 16 Feb 2001 08:54:45 -0700 (MST)
Re:  for-each question
Alec Cove wrote:
> Is there a way to specify how xsl:for-each iterates?
> 
>  For example to have it loop by two in the style of:
> for (int i  =  0; i  < 20; i += 2)

You can't increment an arbitrary counter, but if you want to iterate over
every 2nd node in a set:

<xsl:for-each select="/xpath/for/some/nodes[position() mod 2 = 1]">

for example. Generally, the problems people want to solve by counting from
0 to n are things that can be solved without using a counter at all. Post
your actual problem if this isn't helpful.

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



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


Current Thread
  • for-each question
    • Alec Cove - Fri, 16 Feb 2001 10:00:45 -0500 (EST)
      • cutlass - Fri, 16 Feb 2001 10:16:52 -0500 (EST)
      • Mike Brown - Fri, 16 Feb 2001 10:54:25 -0500 (EST) <=

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.