This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I can't find any statement in the XQuery Update spec as to whether an "insert" operation that inserts an attribute node can replace an existing attribute of the same name, or whether it fails with some dynamic error if an existing attribute of the same name already exists.
My interpretation is as follows: (1) The Insert expression generates an upd:insertAttributes primitive on the Pending Update List (PUL). (See Section 2.4.1) (2) At the end of the snapshot, upd:applyUpdates is invoked, causing the upd:insertAttributes primitive to be applied. At this moment, the parent element has two attributes with the same name. (See Section 3.1.6) (3) In Step 5 (formerly Step 6) of upd:applyUpdates, the XDM instance is checked for violation of data model constraints. Two attributes with the same name and parent violate a data model constraint, so the query terminates with XUDY0021. Since updates are applied atomically, the resulting XDM is unchanged. (See Section 3.2.2) Regards, Don Chamberlin (speaking for myself)
On 15 Jan 2008 the working group considered this bug report and decided that the existing specification is sufficiently clear. Since the submitter was present at the discussion, I am marking this bug report as "Closed".