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

RE: [xsl] generic sort based on attribute names

Subject: RE: [xsl] generic sort based on attribute names
From: "Chaitanya Desai" <cdesai@xxxxxxxxxxx>
Date: Thu, 27 Jan 2005 17:39:16 -0800

Thanks Joris,
This solution works correctly. However, performance is taking a hit. I
want to apply this transformation to large XML files (in the order of
10MB). I tried various XML parsers (MSXML, Saxon, XALAN, JAXP), but none
of them perform acceptably (the CPU and memory, both are pinned and the
application does not respond).
Any performance tips?

-----Original Message-----
From: Joris Gillis [mailto:roac@xxxxxxxxxx]
Sent: Wednesday, January 26, 2005 12:18 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] generic sort based on attribute names

Tempore 00:40:28, die 01/26/2005 AD, hinc in
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Chaitanya Desai

> I am still not getting the desired output.
Oops, little mistake in the predicate:

> <xsl:template match="*">
> 	<xsl:variable name="sortkey">
> 		<xsl:for-each select="*">
> 			<e>
> 				<xsl:for-each select="@*">
> 					<xsl:sort select="name(.)"/>
> 					<xsl:value-of select="name()"/>
> 				</xsl:for-each>
> 			</e>
> 		</xsl:for-each>
> 	</xsl:variable>
> 	<xsl:copy>
> 		<xsl:for-each select="@*">
> 			<xsl:sort select="name(.)"/>
> 			<xsl:copy-of select="."/>
> 		</xsl:for-each>
> 		<xsl:apply-templates>
> 					<!-- the select for this sort
needs to be the concatenated
> name-value pairs of
> 	all the attributes sorted in alphabetical order -->
> 	<xsl:sort
should have been:
> 		</xsl:apply-templates>
> 	</xsl:copy>
> </xsl:template>

Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Vincit omnia simplicitas
Keep it simple

Current Thread