RE: for loop with variable??
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()" /> <!-- 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()" /> </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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format