This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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()[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@infinity-insurance.com]
> Sent: Wednesday, March 07, 2001 1:16 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]