Last active
December 28, 2015 08:19
-
-
Save caschwartz/7470252 to your computer and use it in GitHub Desktop.
XQuery - Query to locate and comment out the empty MODS titleInfo elements using MarkLogic xdmp:node-replace()
This file contains hidden or 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"; | |
| (: 11/13/13 Query to locate and comment out empty MODS titleInfo elements :) | |
| declare namespace mods = "http://www.loc.gov/mods/v3"; | |
| for $doc in xdmp:directory("/MODS/", "infinity") | |
| let $titles := $doc/mods:modsCollection/mods:mods/mods:titleInfo | |
| for $title in $titles | |
| return if (fn:normalize-space($title) = "") then | |
| xdmp:node-replace($title, comment{ xdmp:quote($title) }) | |
| else () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment