[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: generic sort based on attribute names

Subject: RE: generic sort based on attribute names
From: "Chaitanya Desai" <cdesai@xxxxxxxxxxx>
Date: Thu, 27 Jan 2005 17:39:16 -0800
xsl sort name sortkey
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?
Thanks

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

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

> 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
>
select="xx:node-set($sortkey)//e[position()=count(current()/preceding-si
bling::*)]"/>
should have been:
<xsl:sort
select="xx:node-set($sortkey)//e[position()=count(current()/preceding-si
bling::*)+1]"/>
> 		</xsl:apply-templates>
> 	</xsl:copy>
> </xsl:template>


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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.