I have an XML like this
<root>
<aree fbc="123" ad="12" b="123"/>
<beee c="12" a="144"/>
</root>
Need to sort names of attributes by alphabet order. Like this:
<root>
<aree ad="12" b="123" fbc="123"/>
<beee a="144" c="12"/>
</root>
I have an xQuery code, but it don't work right. Help with it please. I need to replace to real name of node
select @data.query('<root>{for $i in root/* return <aaa> {for $j in $i/@* order by local-name($j) return $j} </aaa> }</root>')