Re: [xsl] Sorting and replacing content

Subject: Re: [xsl] Sorting and replacing content
From: "Kenny Bogoe (BogoeMD)" <kenny@xxxxxxxxx>
Date: Wed, 01 Sep 2004 13:32:36 +0200
Thanks.

What I have learned from this forum is to be very precise when making an
example to try to simplify a real life situation.

In the real case the tags <A> to <E> are more like <Order1> to <Order5> and
<a> to <e> are like <Show1> to <Show5>. That will make the use of uppercase
/ lowercase functions useless.

<Root>
    </...>
    <Show1>10</Show1>
    <Show2>20</Show2>
    <Show3>30</Show3>
    <Show4>40</Show4>
    <Show5>50</Show5>
    </...>
    ...
    ...
    <Order1>3</Order1>
    <Order2>5</Order2>
    <Order3>1</Order3>
    <Order4>2</Order4>
    <Order5>4</Order5>
    </..>
</Root>

And it needs to be:

<no>30</no>
<no>40</no>
<no>10</no>
<no>50</no>
<no>20</no>

Thanks in advance.
Kenny Bogoe



> Hi,
> 
> I have this structure where the content of tags <A> to <E> have to determine
> the order of tag-content <a> to <e>. The result needs to be as shown below.
> 
> I can manage to make a stylesheet with an <xsl:if> for each <A> to <E>
> asking whether the number is 1, 2, 3, 4 or 5, but I am sure there must be a
> simpler way to do this. I can not use position() since the position af the
> tags can change in the structure.
> 
> <Root>
> <a>10</a>
> <b>20</b>
> <c>30</c>
> <d>40</d>
> <e>50</e>
> ...
> 
> ...
> <A>3</A>
> <B>5</B>
> <C>1</C>
> <D>2</D>
> <E>4</E>
> </Root>
> 
> Result I need:
> 
> <no>30</no> <!-- C = 1 has to be first with the value of c (which is 30) -->
> <no>40</no>
> <no>10</no>
> <no>50</no>
> <no>30</no>
> 
> 
> Thanks.
> Kenny Bogoe

Current Thread