Last active
October 5, 2015 17:28
-
-
Save caschwartz/2844467 to your computer and use it in GitHub Desktop.
XQuery - Query to add TYPE attributes for incomplete items in METS documents
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 "1.0-ml"; | |
(: 3/8/12 Query to add TYPE attributes for incomplete items in METS documents :) | |
declare namespace mets = "http://www.loc.gov/METS/"; | |
let $doc := fn:doc("/METS/Kuyper128.xml") | |
let $seriesNum := "128" (: Series number for incomplete items :) | |
let $divs := $doc/mets:mets/mets:structMap//mets:div (: Will work with any div at any level in the hierarchy :) | |
for $div in $divs | |
where fn:substring($div/@ID, 7) = $seriesNum (: Substring is number without "Kuyper" :) | |
return if ($div/@TYPE) then | |
xdmp:node-replace($div/@TYPE, attribute TYPE { "suppress" }) | |
else xdmp:node-insert-child($div, attribute TYPE { "suppress" }) | |
xquery version "1.0-ml"; | |
(: 3/8/12 Query to add TYPE attributes for incomplete items in the kuyper-dl database :) | |
declare namespace mets = "http://www.loc.gov/METS/"; | |
let $doc := fn:doc("/METS/Kuyper128.xml") | |
let $seriesNum := "128" (: Cortney will provide series number for incomplete items :) | |
let $divs := $doc/mets:mets/mets:structMap//mets:div (: Will work with any div at any level in the hierarchy :) | |
for $div in $divs | |
where fn:substring($div/@ID, 7) = $seriesNum (: Substring is number without "Kuyper" :) | |
return if ($div/@TYPE) then | |
xdmp:node-replace($div/@TYPE, attribute TYPE { "suppress" }) | |
else xdmp:node-insert-child($div, attribute TYPE { "suppress" }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment