Last active
December 18, 2015 23:19
-
-
Save caschwartz/5860967 to your computer and use it in GitHub Desktop.
XQuery - Query embedded MARC records for edition statements and create <edition> element for local metadata schema
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"; | |
(: 6/19/12 Query theocom documents for edition statements and create <edition> elements :) | |
declare namespace ia = "http://digital.library.ptsem.edu/ia"; | |
declare namespace m = "http://www.loc.gov/MARC21/slim"; | |
for $doc in xdmp:directory("/ia-xml/l/ly/", "infinity") | |
let $marc := $doc/ia:doc/ia:metadata/ia:marc/m:record | |
let $id := $doc/ia:doc/ia:metadata/ia:id | |
let $sortTitle := $doc/ia:doc/ia:metadata/ia:sortTitle | |
let $edition := $marc/m:datafield[@tag = "250"] | |
let $newNodeEdition := <edition xmlns="http://digital.library.ptsem.edu/ia">{ fn:normalize-space($edition) }</edition> | |
let $newLine := text {" "} | |
let $indent := text {" "} | |
where $edition | |
return let $empty := xdmp:node-insert-after($sortTitle, $newLine) | |
let $empty := xdmp:node-insert-after($sortTitle, $indent) | |
let $empty := xdmp:node-insert-after($sortTitle, $newNodeEdition) | |
return () | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment