[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] listing elements based on 2 conditions


Subject: Re: [xsl] listing elements based on 2 conditions
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 5 Jul 2007 13:39:55 +0530

Shouldn't this work..

<xsl:for-each select="element[type = 'business']">
 <xsl:if test="position() &lt; 6">
   <xsl:copy-of select="name" />
 </xsl:if>
</xsl:for-each>

On 7/5/07, Vaduvoiu Tiberiu <vaduvoiutibi@xxxxxxxxx> wrote:
Hi, i'm having an aparenty simple problem but I can't find a convenient solution to it.
I have a list like this:

<element>
   <name>name1</name
   <type>bussines</type>
</element>

<element>

<name>name2</name

<type>sport</type>

</element>

<element>

<name>name3</name

<type>bussines</type>

</element>

I need to display the name of the first 5 elements that have the type bussines.
First I tried using if test="position() < 6 and type="bussines" but this only displays the names from the first 5 news that are type bussines when I actually need the first 5 of type bussines from the whole list. anyone knows an easy way to do this ( in xslt 1.0 )??? 10x


--
Regards,
Mukul Gandhi

http://gandhimukul.tripod.com/


Current Thread
Keywords