Yet one another problem with sorting.

Discussion in 'XML' started by OllimaX, Oct 9, 2003.

  1. OllimaX

    OllimaX Guest

    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!
    OllimaX, Oct 9, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. loveNUNO
    Replies:
    2
    Views:
    907
    loveNUNO
    Nov 20, 2003
  2. Berehem
    Replies:
    4
    Views:
    549
    Lawrence Kirby
    Apr 28, 2005
  3. luser- -droog

    Yet another one-page toy interpretter

    luser- -droog, Jan 14, 2011, in forum: C Programming
    Replies:
    0
    Views:
    246
    luser- -droog
    Jan 14, 2011
  4. Robert Cohen
    Replies:
    3
    Views:
    265
    Andrew Durstewitz
    Jul 15, 2003
  5. Erik Veenstra
    Replies:
    5
    Views:
    346
    Trans
    Aug 22, 2006
Loading...

Share This Page