[xslt] Sorting with <xsl:sort>


  I have a xml like:

<name>firts name</name>
<name>second name</name>
<name>third name</name>

<name>another first name</name>

So every person could have several names (like "Arthur Charles" Clarke):


I need to sort all person -- sort through first name, all persons with the same first name sort through second name etc. There is no restriction on number of names per person. The way I find is something like:

<xsl:for-each select="person">
<xsl:sort select="name[1]"/>
<xsl:sort select="name[2]"/>
<xsl:sort select="name[n]"/>

But what if the person have more than n names? So this solution is not good. Another way I see is to make my own sorting, but it is not ellegant. I hope there is another way to solve this. Any suggestions?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]