|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








