[MarkLogic Dev General] finding the difference between two
documents
Michael Blakeley
michael.blakeley at marklogic.com
Thu May 31 06:06:21 PDT 2007
Charles Blair wrote:
> i'm looking for an easy way to compare differences between two
> documents, something that will return just those elements that are
> different, something like op:except in the w3c recommendation. if
> anyone has such a thing, i'd appreciate it. thanks.
If I understand correctly, op:except isn't suitable for your use-case
because op:except uses node-identity comparison. So this sounds like a
job for fn:deep-equal().
let $a := document { <test id="a"/> }
let $a1 := document { <test id="a"/> }
let $b := document { <test id="b"/> }
return ($a1, $b)[ not(deep-equal(., $a)) ]
=> <test id="b"/>
http://www.w3.org/TR/xpath-functions/#func-deep-equal
-- Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4532 bytes
Desc: S/MIME Cryptographic Signature
Url : http://xqzone.marklogic.com/pipermail/general/attachments/20070531/52265900/smime.bin
More information about the General
mailing list