[xsl] Encompassing Element extraction

Subject: [xsl] Encompassing Element extraction
From: <mhbush@xxxxxxxxxxx>
Date: Mon, 16 Oct 2006 10:53:42 -0500 (CDT)
sent to xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Looking to create a particularly encompassing Element extraction using keys in XSL.

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

Example XML:
<a1>
   <b1>
      <c1/>
      <c2/>
   </b1>
   <b1>
      <c1/>
      <c3/>
   </b1>
   <b2>
      <c2/>
      <c3/>
   </b2>
   <b3>
      <c1/>
      <c4/>
   </b3>
</a1>
<a1>
   <b2/>
   <b3/>
</a1>


I want the following output (with a count in parens):
(2) a1
(2) a1/b1
(2) a1/b1/c1
(1) a1/b1/c2
(1) a1/b1/c3
(2) a1/b2
(1) a1/b2/c2
(1) a1/b2/c3
(1) a1/b3
(1) a1/b3/c3
(1) a1/b3/c4


Things to notice:
 - all nodes can be repeated
 - any name for any node (dont rely on a1,b1,c1 etc.)
 - unique key for each type of node (based on depth)
 - two different nodes with the same name are joined
    (a1/b1 + a1/b2 are both included in a1)
 - potentially very large xml files to be parsed, should go line by line through the source files and create one list of keys. Follow guidelines written by Muenchian Method, found at http://www.jenitennison.com/xslt/grouping/muenchian.html

Any insight you are able to provide would be most useful.
thanks,
-m

Current Thread