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

slicing an XML document

Subject: slicing an XML document
From: Saverio Perugini <sperugin@xxxxxxxxxxxxxxxx>
Date: Tue, 15 Oct 2002 13:15:53 -0400 (EDT)
xml slicing
Hello,

Is it possible to slice an XML tree into levels?
In other words, parameterize a stylesheet by level number and
return all tags or name()'s corresponding to that level.

Consider the following XML:

<db>
   <small>
      <olives>
         <thin/>
      </olives>
      <onions>
         <thin/>
         <thick/>
      </onions>
   </small>
   <med>
      <onions>
         <pan/>
         <thin/>
      </onions>
      <peppers>
         <crispy/>
         <thick/>
      </peppers>
   </med>
   <large>
      <peppers>
         <pan/>
         <thin/>
      </peppers>
      <ham>
         <crispy/>
         <thick/>
      </ham>
   </large>
</db>

Imagine that the leaves correspond to a pizza order and the levels correspond to
size, topping, and crust, in that order.

If I'd like a list of all possible sizes then I want to slice the tree at the
first level; and desire the following output.

small, med, large

If I'd like a list of all possible toppings, then I want to slice the tree at the
second level; and desire the following output.

olives, onions, peppers, ham

And lastly, if I'd like a list of all possible crusts, then I want to slice the tree
at the third level; and desire the following output.

thin, thick, pan, crispy

Is there a quick and dirty way to slice an XML document?

Thank You and Best Regards,

S. Perugini


 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.