This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: for loop with variable??
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] for loop with variable??
- From: Adam Van Den Hoven <Adam dot Hoven at bluezone dot net>
- Date: Wed, 7 Mar 2001 13:35:28 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
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