Skip to content

Instantly share code, notes, and snippets.

@davidamichelson
Last active August 16, 2016 14:28
Show Gist options
  • Select an option

  • Save davidamichelson/4d87c9740b638441bb120e7b21173c6d to your computer and use it in GitHub Desktop.

Select an option

Save davidamichelson/4d87c9740b638441bb120e7b21173c6d to your computer and use it in GitHub Desktop.
xquery version "3.0";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
for $zptr in fn:collection("/db/apps/srophe-data/data/bibl/tei")//tei:idno[@type="zotero"]/text()
let $uri := replace($zptr/ancestor::tei:TEI/descendant::tei:publicationStmt/descendant::tei:idno[@type="URI"][starts-with(.,'http://syriaca.org/')]/text(),'/tei','')
let $oldptr :=
for $ptr in fn:collection("/db/apps/srophe-data/data/persons/tei")//tei:person/tei:bibl/tei:ptr
where $ptr/@target/string()[.=$zptr]
return $ptr
return
update replace $oldptr with <ptr xmlns="http://www.tei-c.org/ns/1.0" target="{$uri}"/>
@davidamichelson

Copy link
Copy Markdown
Author

replacezoterowithuriptr.xqy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment