xsl-list
[Top] [All Lists]

RE: generic sort based on attribute names

2005-01-27 18:39:16
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(_at_)pandora(_dot_)be] 
Sent: Wednesday, January 26, 2005 12:18 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] generic sort based on attribute names

Tempore 00:40:28, die 01/26/2005 AD, hinc in  
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Chaitanya Desai  
<cdesai(_at_)syncata(_dot_)com>:

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>