xsl-list
[Top] [All Lists]

Re: generic sorting problem

2005-09-06 13:10:03

I need to sort the children of the root element by _their_ first child.

I suggest you try this for a starters:

<xsl:template match="/*">
        <xsl:copy>
                <xsl:copy-of select="@*"/>
                <xsl:for-each select="*">
                        <xsl:sort select="*[1]"/>
                        <xsl:copy-of select="."/>
                </xsl:for-each>
        </xsl:copy>
</xsl:template>


Excellent, Thanks so much.

And I simply change the "1" to sort on another sub element I see ! I understimated the flexibility of this xsl.

Do you care to give a blow by blow account of the above ?

Should I be looking at xpath or something before playing with xsl ? I must be going about it the wrong way. Oh well, more fun :)

Thanks again.

Peter

_________________________________________________________________
MSN Messenger 7.5 is now out. Download it for FREE here. http://messenger.msn.co.uk


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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