Subject: Re: [xsl] How to sort attribute? From: Tony Lavinio <xml1@xxxxxxxxxxx> Date: Mon, 15 Aug 2005 01:20:13 -0400 |
I implement a parser of one XML related spec. In it, it defines the format of output file clearly.
"... ... is canonical in the sense that within each child element of the root, the attributes are sorted lexicographically, and then those elements are sorted lexicographically with respect to the element names and attribute values."
If xerces or xalan cannot do it, that will be a big trouble for me.
If you want canonical XML, there is more to it than just having the attributes sorted in order by name. There are whitespace issues, the encoding must be in UTF-8, there can be no <?xml?> prolog at the beginning, etc.
That particular aspect is handled by the serializer; no amount of XSLT coding will guarantee that attributes come out in any given order.
Why exactly must they be in that order? What "big trouble" will it cause?
If you are depending on the order of attributes to be alphabetical, then you are not writing an XML parser. You're writing a parser that accepts some *subset* of well-formed XML documents, which is a different beast.
-- Sincerely, Tony Lavinio Stylus Studio Principal Software Architect http://www.stylusstudio.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to sort attribute?, Colin Paul Adams | Thread | RE: [xsl] How to sort attribute?, Michael Kay |
Re: [xsl] How to sort attribute?, Colin Paul Adams | Date | [xsl] How can I placed end tags?, aaron apigo |
Month |