Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Yet one another problem with sorting.

Reply
Thread Tools

Yet one another problem with sorting.

 
 
OllimaX
Guest
Posts: n/a
 
      10-09-2003

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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [SI] Yet another bad one dickr2 Digital Photography 8 03-31-2011 02:14 AM
Yet another one-page toy interpretter luser- -droog C Programming 0 01-14-2011 05:23 AM
Yet another book recommendation, but for someone who can program and yet does not the terminology well Berehem C Programming 4 04-28-2005 05:25 PM
Using One XSLT and multiple XML Problem (One is XML and another one is XBRL) loveNUNO XML 2 11-20-2003 06:47 AM
Passing value from one script on one page to another script on another page. Robert Cohen ASP General 3 07-15-2003 01:46 PM



Advertisments