Created
September 25, 2014 13:59
-
-
Save meau/e4c0ce7e3a6f5eaba46d to your computer and use it in GitHub Desktop.
getting the @ids of duplicated parent notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.0"; | |
declare namespace ead="urn:isbn:1-931666-22-9"; | |
declare namespace xlink = "http://www.w3.org/1999/xlink"; | |
<dupes> | |
{ | |
for $ead in ead:ead | |
let $doc := base-uri($ead) | |
return | |
<document uri="{$doc}"> | |
{ | |
for $note in $ead//ead:dsc//ead:odd | |
let $parent-notes := $note/parent::ead:*/parent::ead:*/ead:odd | |
for $p in $parent-notes | |
let $noteid := $p/@id | |
let $xpath := replace(path($p),'\[1\]','') | |
let $xpathNS := replace($xpath, 'Q\{urn:isbn:1-931666-22-9\}', 'ead:') | |
let $duplicate-test := deep-equal(normalize-space($note), normalize-space($p)) | |
return | |
<note duplicate-parent="{$duplicate-test}"> | |
{ | |
if ($duplicate-test eq true()) | |
then element {'parentid'} {$noteid} | |
else () | |
} | |
</note> | |
} | |
</document> | |
} | |
</dupes> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment