[Bug 4997] [UPD] Replace of attribute nodes can be ambiguous

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4997





------- Comment #1 from chamberl@almaden.ibm.com  2007-09-14 17:18 -------
Hi John,
I believe that the suggested transform expression will succeed. I see nothing
in the update spec to suggest that an error will be raised. Each of the replace
expressions will generate a upd:replaceNode() primitive on the Pending Update
List. Finally upd:applyUpdates() will make these primitives effective, in
either order. The Data Model instance will go through a temporarily invalid
state but the final result is valid and unambiguous. The check for validity of
the XDM takes place in Step 6 of upd:applyUpdates(), at which time the XDM is
valid. 

In fact, you could even change your example to the following one, in which two
attributes are "swapped":

copy $in := <employee name="Rhys Evans" gender="male"/>
modify (
replace node $in/@name with $in/@gender,
replace node $in/@gender with $in/@name
)
return $in

This strange and entirely unmotivated expression is not an error. It returns an
<employee> node that is effectively the same as the constructed one, since
order of attributes is not significant.

Regards,
Don Chamberlin

Received on Friday, 14 September 2007 17:18:52 UTC