xsl-list
[Top] [All Lists]

extracting all elem names of an attribute

2004-01-23 00:04:03
Hello,

How best is the following text extracted
from the following xml, possibly using keys
or some other xslt constructs?

====
size: small, medium, large
crust: thin, pan
topping: olives, pepperoni, peppers
====

<db>
   <large category="size">
      <thin category="crust">
         <olives category="topping/>
         <pepperoni category="topping/>
      </thin>
      <pan category="crust">
         <pepperoni category="topping/>
      </pan>
   </large>
   <medium category="size">
      <pan category="crust">
         <pepperoni category="topping/>
         <olives category="topping/>
         <peppers category="topping/>
      </pan>
   </medium>
   <small category="size">
      <thin category="crust">
         <olives category="topping/>
         <pepperoni category="topping/>
         <peepers category="topping/>
      </thin>
      <pan category="crust">
         <pepperoni category="topping/>
         <olives category="topping/>
         <peepers category="topping/>
      </pan>
   </small>
</db>

The basic approach involves:
  
   - using keys to get a unique list of possible values for the @category 
attribute
   - iterating over these values 
        - printing each followed by a colon
        - getting a unique list of all xml element names which contain this 
particular attribute value
             - iterating over these values
                  printing each
                  printing an endline

Many thanks and Best regards,
Saverio

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



<Prev in Thread] Current Thread [Next in Thread>