Skip to content

Instantly share code, notes, and snippets.

@davidamichelson
Forked from wsalesky/Build Anonymous Name
Created August 16, 2016 21:29
Show Gist options
  • Save davidamichelson/9c8c74a5353cc2323b4d5e506089d7aa to your computer and use it in GitHub Desktop.
Save davidamichelson/9c8c74a5353cc2323b4d5e506089d7aa to your computer and use it in GitHub Desktop.
xquery version "3.0";
declare namespace tei = "http://www.tei-c.org/ns/1.0";
let $list := ("http://syriaca.org/person/1210", "http://syriaca.org/person/1211")
for $uri in $list
return
for $person in fn:doc('/db/apps/srophe-data/data/persons/tei/saints/tei/1210.xml')//tei:person[tei:idno/text()[.=$uri]]
let $name := $person/tei:persName[@xml:lang="en"][contains(@syriaca-tags,"#syriaca-headword")]
let $bibl := $person/tei:bibl[1]
let $newName :=
<persName xmlns="http://www.tei-c.org/ns/1.0" xml:id="{concat('name',substring-after($uri,'/person/'),'-a')}"
xml:lang="en" syriaca-tags="#syriaca-headword">Anonymi {substring-after($uri,'/person/')}</persName>
let $newbio :=
<state type="group" source="#bib{substring-after($uri,'/person/')}-1"/>
let $newtrait :=
<trait xml:lang="en"><label>anonymous</label></trait>
return
(
update value $name/@syriaca-tags with '#anonymous-description',
update insert $newName preceding $name,
update insert $newbio preceding $bibl,
update insert $newtrait preceding $bibl
)
@davidamichelson
Copy link
Author

@wsalesky, it wanted /text() after all, not sure why, but that made it work

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