Created
October 9, 2014 16:33
-
-
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
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"; | |
(: 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