[xsl] re-ordering nodes

Subject: [xsl] re-ordering nodes
From: Srinivasan Guruswami - CSIS Fellow <srini@xxxxxxxxxxxxxxxxx>
Date: Tue, 18 Dec 2001 13:06:29 -0500 (EST)
Hello XSL Experts:
	I am relatively new to XSL and would like to know how the
following transformation can be accomplished through XSL. I have tried
several sample XSL patterns and I would really appreciate if someone can
throw some light.

Input:
-------->

<?xml version="1.0" encoding="UTF-8" standalone = "no"?>
<list>
<o>
  <a/>
  <b/>
  <a>
     <o> 1 </o>
     <o> 2 </o>
  </a>
  <b>
     <o> 3 </o>
     <o>
        <a value="1"/>
        <b value="2"/>
        <o> 4 </o>
     </o>
  </b>
</o>
</list>


Output
---------->

<?xml version="1.0" encoding="UTF-8" standalone = "no"?>
<list>
<o> 1 </o>
<o> 2 </o>
<o> 3 </o>
<o> 4 </o>
<o>
  <a value="1">
  <b value="2">
</o>
<o>
 <a/>
 <b/>
 <a> <!-- for 1, 2 --> </a>
 <b> <!-- for 3, 4 --> </b>
</o>
</list>

---- End of listing ---->

The goal is to re-group all the <o> nodes at the first level from the root
node. The relative order is not so much of a concern at this time.

Thanks,
-Srini


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread