Position of attributes using copy/modify
Monday, 6 July 2020 · 2 messages · last reply 8 Jul 2020
GC
Giuseppe G. A. Celano6 Jul 2020 19:57 #
Hi,
I know that the order of attributes in XML is not relevant, but I am wondering whether there is a way to add an attribute as the last one using copy/modify expression. The “as last” option seems not to work for attributes.
Cheers,
Giuseppe
CG
Christian Grün8 Jul 2020 14:41 #
Hi Giuseppe,
the attribute order cannot be enforced indeed. We can’t even guarantee that the attributes of a parsed document are returned in the same order when it’s serialized. This is due to the spec: attributes are treated as node properties with no particular order.
A question in reverse: Why do you need attributes to be returned in a particular order?
Ciao,
Christian
Quoted text · Giuseppe G. A. Celano · 9 lines
On Mon, Jul 6, 2020 at 7:57 PM Giuseppe G. A. Celano <celano at informatik.uni-leipzig.de> wrote: > > Hi, > > I know that the order of attributes in XML is not relevant, but I am wondering whether there is a way to add an attribute as the last one using copy/modify expression. The “as last” option seems not to work for attributes. > > Cheers, > Giuseppe
Written for BaseX 9.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery