Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Last active December 21, 2015 21:38
Show Gist options
  • Save caschwartz/6369171 to your computer and use it in GitHub Desktop.
Save caschwartz/6369171 to your computer and use it in GitHub Desktop.
XQuery - Query headers in EAD documents and create a new text nodes with the colons removed using MarkLogic imperative function
xquery version "1.0-ml";
(: 8/27/13 Query all headers in EAD documents and create a new text nodes with the colons removed using MarkLogic imperative function :)
declare namespace ead = "urn:isbn:1-931666-22-9";
let $docs := xdmp:directory("/EAD/")
let $headers := $docs/ead:ead//ead:head
for $header in $headers
where fn:ends-with($header, ":")
order by $header
return xdmp:node-replace($header/text(), text{ fn:replace($header, ":$", "") })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment