Newbie question: how to count equal nodes into one result element

Subject: Newbie question: how to count equal nodes into one result element
From: Tarkanyi Ferenc <Ferenc@xxxxxxx>
Date: Mon, 21 Jun 1999 14:31:15 +0200
Hello,

I have the following problem:

This is the source tree:
<count_this>
      <tag>apple</tag>
      <tag>apple</tag>
	<tag>apple</tag>
	<tag>banana</tag>
	<tag>banana</tag>
	<tag>cherry</tag>
	<tag>cherry</tag>
	<tag>cherry</tag>
	<tag>cherry</tag>
</count_this>

The result tree should be something like this:
<result>
     <tag><value>apple</value><occurred>3</occurred></tag>
     <tag><value>banana</value><occurred>2</occurred></tag>
     <tag><value>cherry</value><occurred>4</occurred></tag>
</result>

So generally the question is how can I count equal nodes and put the
result into one result node with XSLT?
Any idea would be appreciated.
Thank you.

Ferenc Tárkányi
project manager, R&D
ObjX International
tel: +36 13280090
e-mail: ferenc@xxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread