[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: generic sort based on attribute names
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|