This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Xalan attribute order
- From: "Anthony B. Coates" <abcoates at TheOffice dot net>
- To: xsl-list <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 28 Aug 2002 19:00:25 +0100
- Subject: Re: [xsl] Xalan attribute order
- References: <APEPJGIEBJJFIKLJOFLIKEJCCOAA.bayer@oio.de> <3D6D0779.2080102@gmx.de>
- Reply-to: xsl-list at lists dot mulberrytech dot com
> Thomas Bayer wrote:
> > Hallo,
> >
> > I know, attribute order doesn't matter, and if order matters, something is
> > wrong. But I generate HTML from XML and there are old tools. So I have to
> > keep the attribute order. I guess Xalan sorts the attributs alphabetically.
> > Is there a way, to change the behaviour of Xalan?
Well, if you are copying from input to output and want to keep the attributes
in alphabetic order, you could so something like
<xsl:template match = "*">
<xsl:copy>
<xsl:for-each select = "@*">
<xsl:sort select = "name()"/>
<xsl:copy/>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
Cheers,
Tony.
====
Anthony B. Coates, Data Architect
mailto:abcoates@TheOffice.net
MDDL Editor (Market Data Definition Language)
http://www.mddl.org/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list