Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Created October 9, 2014 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caschwartz/2db50376d8041e18e6c0 to your computer and use it in GitHub Desktop.
Save caschwartz/2db50376d8041e18e6c0 to your computer and use it in GitHub Desktop.
Query accessions database to correct the location of the xml schema document for validation of accessions records
xquery version "1.0-ml";
(: 10/9/14 Query accessions database to correct the location of the xml schema document for validation :)
declare namespace arch = "http://www.inmagic.com/webpublisher/query";
for $doc in fn:collection()
let $oldAttributeNode := $doc/arch:Record/@xsi:schemaLocation
let $schemaLoc := $doc/arch:Record/@xsi:schemaLocation/fn:string()
where $schemaLoc
return if (fn:contains($schemaLoc, "Z:")) then
xdmp:node-replace($oldAttributeNode, attribute xsi:schemaLocation { fn:translate($schemaLoc, "Z", "R") })
else if (fn:contains($schemaLoc, "S:")) then
xdmp:node-replace($oldAttributeNode, attribute xsi:schemaLocation { fn:translate($schemaLoc, "S", "R") })
else ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment