xsl-list
[Top] [All Lists]

RE: sorting on elementnames

2003-09-26 08:18:00
After cleaning up your child element tags (they are not closed, therefor your 
document is not XML), this template will do the trick:

<xsl:template match="/something">
 <something>
  <xsl:for-each select="*" >
    <xsl:sort select="name()" order="ascending" data-type="text" />
    <xsl:copy-of select="." />
  </xsl:for-each>
 </something>
</xsl:template>
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     "marcel salathe" <ms7141(_at_)gmx(_dot_)de>
Sent:     Fri, 26 Sep 2003 16:51:40 +0200 (MEST)
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  [xsl] sorting on elementnames

Hello

A rather simple question: how can I sort on element names?

All sorting examples I've found sort on attribute values or element values,
but not on element names. 
For example, I have

<something>
   <a>
   <b>
   <b>
   <a>
   <b>
</something>

and I want to get 

<something>
   <a>
   <a>
   <b>
   <b>
   <b>
</something>

Thanks very much for help!

Regards,
Marcel

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>
  • RE: sorting on elementnames, cknell <=