Subject: Re: Just the first 'x' elements within a for-each
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 17 Mar 2003 17:42:03 +0000
|
Hi Simon,
> I've tried numerous connotations of for-each loops, recursive
> functions etc but for the life of me I can't seem to get something
> which will only print/process the first 'x' (in my case x is 2)
> elements and then bail out of the for-each or just simply ignore the
> remaining ones found.
In declarative programming, you can't "bail out". Instead, try
selecting only the elements that you want to process:
<xsl:for-each select="*[position() <= 2]">
...
</xsl:for-each>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|