[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

extracting all elem names of an attribute

Subject: extracting all elem names of an attribute
From: Saverio Perugini <sperugin@xxxxxxxxxxxxxxxx>
Date: Fri, 23 Jan 2004 02:04:03 -0500 (EST)
names of olives
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.