Subject: RE: [xsl] attribute order From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Fri, 22 Feb 2002 10:32:23 -0000 |
Current releases of Saxon will output attributes in the order they are processed in the stylesheet, unless you attempt to output two attributes with the same name. But attributes copied from the source document can be reordered by the XML parser (and sometimes are). But you shouldn't rely on this behavior for anything except the cosmetic appearance of the output. Any software that depends on attribute order in an XML document is plain wrong. (There is universal consensus that in XML, element order is important but attribute order isn't. There is nothing explicit in the XML specification that says this, but it's made clear in the definition of the InfoSet.) Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Andy Joslin > Sent: 22 February 2002 10:04 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] attribute order > > > Hi Peter > > I've just tried rearranging the attributes and the processor > (in my case, > Xalan/Xerces) does seem to respect the order.. > > e.g. > > <xsl:attribute name="width">580</xsl:attribute> > <xsl:attribute name="cellpadding">0</xsl:attribute> > <xsl:attribute name="cellspacing">0</xsl:attribute> > <xsl:attribute name="border">0</xsl:attribute> > > becomes... > > <table width="580" cellspacing="0" cellpadding="0" border="0"> > > > I can't speak for other processors, but this works for me. I > don't know what > setup Meltem is using, but it would be interesting to see if > this behaviour > is consistent across implementations. > > > cheers > > > Andy > > > > > > > -----Original Message----- > From: Peter Davis [mailto:pdavis152@xxxxxxxxx] > Sent: 21 February 2002 19:34 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] attribute order > > > > It was my experience that processors that change the order tend to > alphabetize the attributes, or, if the processor happens to store the > attributes in a hash-map of some kind, seemingly random > order. Have you > tried if rearranging the attribute-set has the same effect in > the output? > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] attribute order, Andy Joslin | Thread | Re: [xsl] attribute order, David Carlisle |
RE: [xsl] attribute order, Andy Joslin | Date | RE: [xsl] attribute order, Meltem Kogelbauer |
Month |