Re: [xsl] generic sorting problem

Subject: Re: [xsl] generic sorting problem
From: "peter willard donisthorpe" <paytur@xxxxxxxxxxx>
Date: Tue, 06 Sep 2005 20:10:03 +0000
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


Current Thread