Skip to content

Instantly share code, notes, and snippets.

@caschwartz
Last active December 18, 2015 22:09
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/5852617 to your computer and use it in GitHub Desktop.
Save caschwartz/5852617 to your computer and use it in GitHub Desktop.
XQuery - Query to add <dc:type> element to TEI documents in lectures database
xquery version "1.0-ml";
(: 6/7/13 Query to add <dc:type> element to TEI documents in lectures database :)
declare namespace tei = "http://www.tei-c.org/ns/1.0";
declare namespace localtei = "http://digital.library.ptsem.edu/lectures/tei";
declare namespace dc = "http://purl.org/dc/elements/1.1/";
for $teiDoc in xdmp:directory("/TEI/", "infinity")
let $id := $teiDoc/tei:TEI/tei:teiHeader/localtei:metadata/dc:identifier
let $newNode := <dc:type xmlns:dc="http://purl.org/dc/elements/1.1/">Lecture</dc:type>
return xdmp:node-insert-after($id, $newNode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment