This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

merge tree structure with no redundancy


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]