xsl-list
[Top] [All Lists]

Sort question

2003-02-27 08:15:38
Is it possible to sort a set of elements with an unknown number of sort keys:

<root>
        <crumbtrail>
                <crumb>top</crumb>
                <crumb>sport</crumb>
                <crumb>football</crumb>
                <crumb>liverpool</crumb>
        </crumbtrail>
        <crumbtrail>
                <crumb>top</crumb>
                <crumb>sport</crumb>
        </crumbtrail>
        <crumbtrail>
                <crumb>top</crumb>
                <crumb>sport</crumb>
                <crumb>cricket</crumb>
        </crumbtrail>
</root>


I need to sort this in the first instance depending on the first crumb element, then if two crumbtrails share identical values on the second crumb element etc.etc.

The problem is There could be any number of crumb elements and I don`t want to have to write

<xsl:sort select="crumb[1]"/>
<xsl:sort select="crumb[2]"/>
<xsl:sort select="crumb[3]"/>
<xsl:sort select="crumb[4]"/>
<xsl:sort select="crumb[5]"/>
.
.
etc.

as the sort key since there could be any number of crumb elements.

Thanks







_________________________________________________________________
MSN Messenger - fast, easy and FREE! http://messenger.msn.co.uk


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>