This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: count the number of occurrences of an element which satisfy some condition
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] count the number of occurrences of an element which satisfy some condition
- From: "Rob Lugt" <roblugt at elcel dot com>
- Date: Thu, 21 Jun 2001 12:03:28 +0100
- References: <711677989624D411B81E00300501625539E9D9@ECCOLCOM01>
- Reply-To: xsl-list at lists dot mulberrytech dot com
From: "Jayaranga Subasinghe" <jayarangas@eurocenter.lk>
>
> I want to count the number of occurrences of an element<keyword>,
> which 'xml:lang' attribute is 'en'.
> the xml file is as follows:
> <KEYWORD xml:lang="en">Keyword 1</KEYWORD>
> <KEYWORD xml:lang="en">Keyword 2</KEYWORD>
> <KEYWORD xml:lang="no">Sokeord 1</KEYWORD>
> <KEYWORD xml:lang="no">Sokeord 2</KEYWORD>
> <KEYWORD xml:lang="no">Sokeord 3</KEYWORD>
>
Hi Jayaranga, try the following:-
<xsl:template match="/">
You have <xsl:value-of select="count(//KEYWORD[@xml:lang='en'])"/> English
KEYWORDs.
</xsl:template>
Regards,
Rob
--
Rob Lugt
ElCel Technology
http://www.elcel.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list