Re: count of element occurrences

Subject: Re: count of element occurrences
From: Paul Tchistopolskii <paul@xxxxxxx>
Date: Tue, 19 Sep 2000 06:58:07 -0700
----- Original Message ----- 
From: Sebastian Rahtz 


> I want a list of all the elements used in my document, with a count of
> how many times they occur. My Muenchian solution is appended, but its
> fairly ugly. Can someone suggest a more elegant method?

I don't know about elegancy, but I can suggest 
a simple solution based on your test6 ;-)

Consider pipe of 3 transformations:

Transformation 1. ( Produce flat list of elements ).

<xsl:stylesheet 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
 version="1.0">

<xsl:template match="/">
 <result>
  <xsl:apply-templates/>
  </result>
</xsl:template>

<xsl:template match='*'>
<xsl:element name="{name()}"/>
<xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>

Transformation 2. sort

So now we have flat file which is sorted - so it is 
ready for:

Transformation 3. Is 'flat-hierarchy' grouping which 
I wrote for your test6.

Rgds.Paul.



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


Current Thread