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

transform from flat to hierarchical

Subject: transform from flat to hierarchical
From: "Ken Tam" <kentam@xxxxxxxxxxxxxxx>
Date: Mon, 27 Nov 2006 00:15:41 -0800
 transform from flat to hierarchical
Hi all,

I need to transform from flat and somewhat unstructured XML to a more
structual form. Here is a sample:

<logs>
  <log>a</log>
  <log>sub b</log>
  <log>c</log>
  <log>sub d</log>
  <log>e</log>
  <log>f</log>
  <log>end of d</log>
  <log>g</log>
  <log>end of b</log>
  <log>h</log>
  <log>i</log>
<logs>

into a more structured content with nesting:

<logs>
  <log name="a">
    <log name="b">
      <log name="c">
        <log name="d">
          <log name="e"/>
          <log name="f"/>
        </log>
      </log>
      <log name="g"/>
    </log>
  </log>
  <log name="h"/>
  <log name="i"/>
</logs>

Is this doable by using XSLT/XPATH?. If yes, please include some sample XSLT
code. I've looked at some examples of "flat to hierarchical" transformations
but they are dealt with nestings that are determined by a single node (i.e.
with a "level" attribute) instead of begin-end node pair (as in the "sub
<node>", "end of <node>" pair from above).

Thanks,
kkt

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-2007 All Rights Reserved.