Auto increment with XQuery Update?
Does XQuery Update support auto increment attributes, just like auto increment fields in SQL ? I'm using BaseX as my database. Arjan Given an answer from Christian Grün on the BaseX mailing list , this is doable when the node one is adding is defined in the XQuery Update statement, and hence can be enhanced using an {enclosed expression} before inserting it: You might specify the attribute counter within your XML file/database and increment it every time when you insert an element. A simple example: input.xml: <root count="0"/> insert.xq: let $root := doc('input.xml')/root let $count := $root/