This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Counting unique node values using XSLT?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]