[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] re-ordering nodes


Subject: Re: [xsl] re-ordering nodes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2001 23:55:39 +0000

Hi Srini,

> "<o>" elements can nest other "<o>" elements as well, among other
> several tags. It seems like <xsl:copy> will copy the entire contents
> of the "<o>" element, including nested "<o>" tags. But, that is not
> the desired behavior.
>
> All "<o>" nodes should be re-ordering at the first level from the
> root. Other tags inside the "<o>" elements are to be preserved in
> the same parent node.

Perhaps you can make it clearer what you want the stylesheet to do. In
your sample, you had:

<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>

as the result from the source:

<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>

To write a stylesheet to give you that result, you need to articulate:

 - why the o elements are in a particular order - what governs that
   ordering?
 - why the comments have been added as they've been added - where do
   the numbers come from?

If you can write down the answers to those questions, chances are you
can write down the XSLT that will give you the structure that you
want. I don't know the answers to those questions, so I can't.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



Current Thread
Keywords