[Home] [By Thread] [By Date] [Recent Entries]
At 2012-09-20 14:16 -0400, John P. McCaskey wrote:
On 9/20/2012 1:41 PM, G. Ken Holman wrote:At 2012-09-20 13:08 -0400, John P. McCaskey wrote:An example right now is a stylesheet that renders TEI documents in a browser. The attributes of an element are listed in two places, displayed differently. I'd prefer they get displayed in the same order in both places.Though not required to by spec, in practice do the major XSL processors treat attributes in document order, alphabetical order, or any other repeated order? I'm sure you mean to say "specified order" here, because I think we've established there is no document order for attributes. Given that XSLT is not designed for markup preservation, there would be other aspects of the document expression lost in your display (e.g. entity references). That specified order happens to be used is a serendipitous coincidence for your application of XSLT. Right now, I'm just guessing that the processor will use document order, and so far I've been right. Fortunately, if it doesn't, nothing catastrophic happens. So I'm not bothering with any hoop jumping on this one. I agree. I see what you see in that a number of processors appear to put the attributes on the attribute axis in specified order, followed by the unspecified defaulted attributes in declaration order. A test is below. . . . . . . . . . Ken t:\ftemp>type doc.xml <!DOCTYPE doc [ <!ATTLIST doc two CDATA "TWO"> <!ATTLIST doc five CDATA "FIVE"> <!ATTLIST doc four CDATA "FOUR"> ]> <doc one="one" two="two" three="three"/> t:\ftemp>type doc.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/*"> <xsl:text>
</xsl:text><xsl:value-of select="@*[1]"/> <xsl:text>
</xsl:text><xsl:value-of select="@*[2]"/> <xsl:text>
</xsl:text><xsl:value-of select="@*[3]"/> <xsl:text>
</xsl:text><xsl:value-of select="@*[4]"/> <xsl:text>
</xsl:text><xsl:value-of select="@*[5]"/> </xsl:template> </xsl:stylesheet> t:\ftemp>xslt-saxon doc.xml doc.xsl doc.out t:\ftemp>type doc.out <?xml version="1.0" encoding="utf-8"?> one two three FIVE FOUR t:\ftemp>xslt-xt doc.xml doc.xsl doc.out t:\ftemp>type doc.out <?xml version="1.0" encoding="utf-8"?> one two three FIVE FOUR t:\ftemp>xslt-xalan doc.xml doc.xsl doc.out t:\ftemp>type doc.out <?xml version="1.0" encoding="UTF-8"?> one two three FIVE FOUR t:\ftemp> t:\ftemp>xslt-msxsl doc.xml doc.xsl doc.out t:\ftemp>type doc.out <?xml version="1.0" encoding="UTF-16"?> one two three FIVE FOUR t:\ftemp> -- Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|

Cart



