Skip to content

Instantly share code, notes, and snippets.

@CliffordAnderson
Forked from zachary-johnson/xquery attempt so far
Created October 13, 2017 22:00
Show Gist options
  • Save CliffordAnderson/c588a38b6c43d023d40d108b1befc8e7 to your computer and use it in GitHub Desktop.
Save CliffordAnderson/c588a38b6c43d023d40d108b1befc8e7 to your computer and use it in GitHub Desktop.
Xquery for Unit Dates
(: This is as far as we got with the xquery command, simply trying to return the data contained in <unitdate> in a single doc for now.:)
xquery version "3.0";
declare namespace ead = "urn:isbn:1-931666-22-9";
let $doc := fn:doc("https://raw.githubusercontent.com/HeardLibrary/finding-aids/master/ASpace/Finalized%20EADs/8.30.17%20batch/HendrixNancy_MSS_206.xml")
for $unitdate in $doc//ead:dsc//ead:unitdate
let $gYear := fn:replace($unitdate, ".*(\d{4}).*", "$1")
return
copy $unitdate := $unitdate
modify insert node attribute { 'normal' } { $gYear } into $unitdate
return $unitdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment