[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to sort attribute?

Subject: Re: How to sort attribute?
From: Tony Lavinio <xml1@xxxxxxxxxxx>
Date: Mon, 15 Aug 2005 01:20:13 -0400
sorts attributes alphabetical by name
On 08-14-2005 10:22 PM, John Li wrote:

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.