Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Created December 10, 2013 22:00
Show Gist options
  • Select an option

  • Save caschwartz/7901026 to your computer and use it in GitHub Desktop.

Select an option

Save caschwartz/7901026 to your computer and use it in GitHub Desktop.
XQuery - Corrected capitalization for collection headings in MODS documents
xquery version "1.0-ml";
(: Fix capitalization of collection titles ("inventory" database) :)
declare namespace mods = "http://www.loc.gov/mods/v3";
fn:distinct-values(
for $doc in fn:collection("MODS")
let $collection-title := $doc/mods:modsCollection/mods:mods/mods:titleInfo[@type="uniform"]
let $normalized := fn:normalize-space($collection-title)
where $collection-title (: Test for presence of collection heading :)
order by $normalized
return fn:replace($normalized, "collection", "Collection"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment