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

RE: for loop with variable??

Subject: RE: for loop with variable??
From: Adam Van Den Hoven <Adam.Hoven@xxxxxxxxxxxx>
Date: Wed, 7 Mar 2001 13:35:28 -0800
for loop with i
All you need to do is use the right axis in your template

Try something like


<xsl:template name="PairedNodes">
	<xsl:param name="FirstNode" />
	<xsl:variable name="SecondNode"
select="$FirstNode/following-sibling::node()[1]" />
	
<!-- Do your thing here checking to ensure that $SecondNode is set properly
since you may	have an odd number of nodes-->
	
	<xsl:call-template name="PairedNodes">
		<xsl:with-param name="FirstNode"
select="$FirstNode/following-sibling::node()[2]" />
	</xsl:call-template>
</xsl:template>

You will probably want to check that the thrird following sibling exists at
the end or that FirstNode has a node in it at the beginning.

> -----Original Message-----
> From: Yan Zhu [mailto:yan.zhu@xxxxxxxxxxxxxxxxxxxxxx]
> Sent: Wednesday, March 07, 2001 1:16 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  for loop with variable??
> 
> 
> 
>     is there a way to use a for loop and a counter sort of variable?
> 
>     I need a way to cycle through a node list, pass two nodes 
> to a template
> at a time.
> 
>     so call the template and pass node1, node2, then
>     do it again with node3, node4
>     do it over and over util all nodes are gone.
> 
>     it that possible?
> 
> thanks
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

 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-2011 All Rights Reserved.