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]

Re: count of element occurrences



----- 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

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