HI --

In the process of trying to find the differences between two collections of
schemas (the XML differences, as opposed to the not-semantically-meaningful
differences in the order of the definitions), I find myself wanting to
stick UIDs on everything.  (So I can go "oh, this element node is
different, but it has descendant elements UIDs also in the list of
differences, I don't want this one, the descendants are more precise"
(because if I don't do something like this, I'm getting xsd:schema every

I haven't done anything with updating expressions before.

By itself, in the GUI,

for $x in /descendant-or-self::*
return insert node(attribute UID {generate-id($x)}) into $x

works.  Since I would like everything in one query, with a little flailing
I've got as far as

let $new as document-node()+ :=
  for $each in db:open($newName)
  copy $temp := $each
  modify (
    for $x in $temp/descendant-or-self::*
    return insert node(attribute UID {generate-id($x)}) into $x
  return $temp

return $new

And there are all the elements with UID attributes associated with them.

Is there a better way to do this?


Reply via email to