Hi Regarding the (not existent) requirement for attribute order:
In http://www.w3.org/TR/2008/REC-xml-20081126/#sec-starttags there is a note "Note that the order of attribute specifications in a start-tag or empty-element tag is not significant."
And my recommendation is: Do not put any extra requirements to any XML, which is not really needed. In case of attributes, you may and up promissing your consumers that the order of attributes will be as you define, and later you may have problems switching tools, which follow W3C recommendation, but not your extra promise.
So the general advice is: keep your promises at minimum possible, it will easy work for you and also for your partners.
The same often applies, when people start insisting on certain XML encoding, encoding or not encoding of special characters - all these requirements are more cosmetic then practical and often do originate from people, who do not understand the topic so well, but are well trained in the exercise "find three differences it those two pictures".
Jan
*Ing. Jan Vlčinský* CAD programy Slunečnicová 338/3, 734 01 Karviná Ráj, Czech Republic tel: +420-597 602 024; mob: +420-608 979 040 skype: janvlcinsky; GoogleTalk: jan.vlcinsky@gmail.com http://cz.linkedin.com/in/vlcinsky
On 2 December 2011 18:46, Dave Glick dglick@dracorp.com wrote:
After a little more investigation of the XQuery Update standard, it looks to me like BaseX is doing this right and the standard does not allow for positioning of attribute insertions (unless there’s another approach I’ve overlooked). In case anyone else has a similar question – all insert operations involving attributes resolve to the function upd:insertAttributes which does not allow for positioning. It appears as though the modifiers “as first” and “as last” are ignored in the case of attributes.****
I suppose this makes sense if the ordering of attributes in XML is unimportant and undefined. Can anyone clarify what the XML/XDM standard has to say on the topic of attribute ordering? It’s a little confusing because many XML processors attempt to present attributes with some kind of explicit ordering (as an example, see the .NET XmlAttributeCollection class which allows programmatic insertion of attributes before/after a reference attribute).****
Thanks (again),****
Dave****
*From:* Dave Glick *Sent:* Friday, December 02, 2011 12:37 PM *To:* basex-talk@mailman.uni-konstanz.de *Subject:* Insert position of attributes****
How would one go about inserting an attribute at a specific position (i.e., somewhere other than at the front of the attribute list)? I would expect the following expression would do the trick: “insert node attribute aname {'avalue'} as last into //XYZ” but it still inserts the attribute at the front of the attribute list.****
By looking at the code in the InsertAttribute update primitive, I can see that it’s hardcoded to insert at the front of the attribute list. Does this mean that there is no way to control attribute insertion location? Does the XQuery Update standard not allow such an update or is this a bug/oversight on the part of BaseX?****
Thanks!****
Dave****
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de