[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] How to sort attribute?


Subject: RE: [xsl] How to sort attribute?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 13 Aug 2005 10:25:51 +0100

Your for-each will process the attributes in sorted order, but once they are
added to the new element they can be reordered by the system, because
attribute order is implementation-dependent. There's no way of controlling
the order in which attributes are output by the serializer.

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: John Li [mailto:johnli121@xxxxxxx] 
> Sent: 13 August 2005 10:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] How to sort attribute?
> 
> Hi,
> 
> When exporting one node and its attribute, I want to sort its 
> attributes
> lexicographic. I try it as below but always fail. Anyone could help?
> 
> <xsl:for-each select="@*">
>     <xsl:sort select="name()"/>
>     <xsl:copy/>
> </xsl:for-each>
> 
> Thanks,
> John


Current Thread