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

Flattening hierarchic xml, retaining some structure

Subject: Flattening hierarchic xml, retaining some structure
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Wed, 19 Jan 2005 14:56:08 +0000
flattening structure
Hi, I have a hierarchic structure, that I would like to flatten.
I have tried looking for some examples, but I have not been able to expand the examples I have found, so that they will work on my problem.
(I have no influence on either input or output format, which is simplified here)


Regards,
Ragulf Pickaxe :-)

Expanding on the example from David Pawson's site:
http://www.dpawson.co.uk/xsl/sect2/flatten.html
I have the following XML and would like to generate the flat structure as shown:


Input XML:
<mynode name="xxx">
 <subnode>Some text</subnode>
 <subnode>
   <mynode name="yyy">
     <subnode><b>Some bold text</b></subnode>
     <subnode>Some text where some of it is <b>bold text</b></subnode>
     <subnode>
       <mynode name="zzz">
         <subnode>Some text</subnode>
         <subnode>Some text</subnode>
       </mynode>
     </subnode>
     <subnode>Yet some text</subnode>
   </mynode>
 </subnode>
 <subnode>Some more text, <i>italic</i> is some of it</subnode>
</mynode>

Output XML:
<mynode name="xxx">
 <subnode>Some text</subnode>
<mynode name="yyy">
 <subnode><b>Some bold text</b></subnode>
 <subnode>Some text where some of it is <b>bold text</b></subnode>
</mynode>
<mynode name="zzz">
 <subnode>Some text</subnode>
 <subnode>Some text</subnode>
</mynode>
<mynode name="yyy">
 <subnode>Yet some text</subnode>
</mynode>
<mynode name="xxx">
 <subnode>Some more text, <i>italic</i> is some of it</subnode>
</mynode>

I have tried some various forms of modes, and such, but alas no success, and no idea how to obtain success. The problem is with retaining the subnode under mynode structure, while also having the subnodes in the same document order as in the input.

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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.