This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Tricky problem, limiting the number of source elements processed.
- To: "XSL List" <xsl-list at mulberrytech dot com>
- Subject: Re: Tricky problem, limiting the number of source elements processed.
- From: "Nikolai Grigoriev" <grig at renderx dot com>
- Date: Tue, 24 Oct 2000 18:51:06 -0400 (EST)
- References: <14837.49489.843000.652358@menteith.com>
- Reply-To: xsl-list at mulberrytech dot com
Dylan,
> Lets say you have two types of elements, "typeA" and "typeB" that you want
> to display, but you only want to display a maximum number of them, say five.
> More particularly, you want to display as many of typeA as possible, up to
> the limit of five, but if there are less than five typeAs, the remaining
> space should be filled with typeBs.
If you can ensure that typeAs always precede typeBs, then
select="*[self::typeA or self::typeB][position() <= 5]"
would probably do the trick; otherwise you will need two separate selects:
select = "typeA[position() <= 5]"
select = "typeB[position() <= (5 - count(typeA))]"
Best regards,
Nikolai
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list