This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Counting unique node values using XSLT?
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Counting unique node values using XSLT?
- From: "Brucato, Greg" <GBrucato at sonusnet dot com>
- Date: Fri, 1 Jun 2001 16:13:16 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
I am using the count() function to successfully count the number of nodes
produced in XML data created using Java.
However, I now have a situation where some of the values are duplicates. Is
there any way to count only unique values?
Example: The count should be 6 not 8 since there are two duplicates in the
second fragment.
<xsl:value-of select="count(trunk-groups/tg)"/>
...
<trunk-groups>
<tg>T1-1-1-1</tg>
<tg>T1-1-1-2</tg>
<tg>T1-1-1-3</tg>
<tg>T1-1-1-4</tg>
</trunk-groups>
...
<trunk-groups>
<tg>T1-1-1-2</tg>
<tg>T1-1-2-3</tg>
<tg>T1-1-1-4</tg>
<tg>T1-1-2-8</tg>
</trunk-groups>
Thanks,
Greg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list