Yet one another problem with sorting.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OllimaX

    #1

    Yet one another problem with sorting.


    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>Hanniba l</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>Hanniba l</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!
Working...