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

merge tree structure with no redundancy

Subject: merge tree structure with no redundancy
From: Benoit Guyon <ben@xxxxxxxxxx>
Date: Fri, 2 Aug 2002 17:42:50 +0200
merge tree
hello,

I have a XML file with nodes that are representing a tree structure. i want
to modify this file (with a XSL stylesheet) to get a new XML file with a
unified tree structure that don't have redundancy.

the original file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
 <subscribers>
   <subscriber>
     <id="1" />
       <path>
         <node type="T1" name="N1">
           <node type="T2" name="N2">
             <node type="T3" name="N3" />
           </node>
         </node>
       </path>
     </subscriber>
   <subscriber>
     <id="2" />
     <path>
       <node type="T1" name="N1">
         <node type="T2" name="N2">
           <node type="T3" name="N4" />
         </node>
       </node>
     </path>
   </subscriber>
 </subscribers>
</a>

the wanted file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<a>
 <node type="T1" name="N1">
   <node type="T2" name="N2">
     <node type="T3" name="N3" id="1" />
     <node type="T3" name="N4" id="2" />
   </node>
 </node>
</a>

I don't know how to make that ... can i test output to detect if a node
(identified with type and name atributes) is
already present ?

when i'm in the second <subscriber> node, how can i detect that i already
wrote the ancestor nodes, and how can i write the final node under the right
ancestor ?

does anybody have an idea or a general algorithm to help me ?

best regards
ben

PS : i use MSXML, i don't have the saxon:path() :/ ;)

 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.