Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Last active August 29, 2018 14:08
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/e758fbc0976e33fdce471869917fd3a6 to your computer and use it in GitHub Desktop.
Save caschwartz/e758fbc0976e33fdce471869917fd3a6 to your computer and use it in GitHub Desktop.
xquery version "1.0-ml";
(: 8/29/18 Query used to add three attributes: type, integer, and id to new <relatedNumber> element :)
declare namespace ia = "http://digital.library.ptsem.edu/ia";
for $doc in collection("pts-journals")
let $vol-info := $doc/ia:doc/ia:metadata/ia:relatedItem/ia:volumeInfo
let $volume := $vol-info/ia:volume
let $number := $vol-info/ia:number
let $rel-number := $vol-info/ia:relatedNumber
where $vol-info
return xdmp:node-insert-child($rel-number, attribute id { $number/@id })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment