Yet one another problem with sorting.

OllimaX

Usenet Archive
Joined
Oct 3, 2003
Messages
25
Reaction score
0
Hi all you fine people!

I tried to view older messages, but couldn't find a match with my present problem.

Please see an example of the original xml.
As you can see, the order of elements is ascending by <date>.

<person>
<date>12</date>
<name>Jack</name>
<child-of name="none" />
</person>
<person>
<date>13</date>
<name>Rover</name>
<child-of name="Jack" />
</person>
<person>
<date>14</date>
<name>Dingaling</name>
<child-of name="Jill" />
</person>
<person>
<date>15</date>
<name>Jill</name>
<child-of name="none" />
</person>
<person>
<date>16</date>
<name>Wooster</name>
<child-of name="Hannibal" />
</person>
<person>
<date>17</date>
<name>Hannibal</name>
<child-of name="none" />
</person>
<person>
<date>18</date>
<name>Moses</name>
<child-of name="Jill" />
</person>

Question:
Assume that we would display elements so that children are printed after their parent. How could I change (by using xsl) the order of elements, so that the result would look like the following:

<person>
<date>12</date>
<name>Jack</name>
<child-of name="none" />
</person>
<person>
<date>13</date>
<name>Rover</name>
<child-of name="Jack" />
</person>
<person>
<date>15</date>
<name>Jill</name>
<child-of name="none" />
</person>
<person>
<date>14</date>
<name>Dingaling</name>
<child-of name="Jill" />
</person>
<person>
<date>18</date>
<name>Moses</name>
<child-of name="Jill" />
</person>
<person>
<date>17</date>
<name>Hannibal</name>
<child-of name="none" />
</person>
<person>
<date>16</date>
<name>Wooster</name>
<child-of name="Hannibal" />
</person>

Thanks in advance for your advice!

Oll¡maX!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top