Skip to content

Instantly share code, notes, and snippets.

@wsalesky
Created June 27, 2016 01:38
Show Gist options
  • Save wsalesky/5b182d79e9af86e9d7e2cd29544d3ee8 to your computer and use it in GitHub Desktop.
Save wsalesky/5b182d79e9af86e9d7e2cd29544d3ee8 to your computer and use it in GitHub Desktop.
declare namespace tei = "http://www.tei-c.org/ns/1.0";
for $r in collection('/db/apps/bug-test/data/persons')//tei:revisionDesc[@status="incomplete"]/ancestor::tei:TEI
let $uri := replace($r/descendant::tei:idno[@type='URI'][1],'/tei','')
let $name := $r/descendant::tei:persName[@syriaca-tags='#syriaca-headword'][@xml:lang='en'][1]/text()
let $pid := substring-after($uri,'person/')
return
for $b in $r//tei:idno[@type='BHS']
let $work-id :=
for $w in collection('/db/apps/srophe-data/data/works')//tei:idno[@type='BHS'][. = $b]
let $wid := replace($w/ancestor::tei:TEI/descendant::tei:idno[@type='URI'][1],'/tei','')
return $wid
let $work-title :=
for $w in collection('/db/apps/srophe-data/data/works')//tei:idno[@type='BHS'][. = $b]
let $wt := $w/ancestor::tei:TEI/descendant::tei:title[1]/text()
return $wt
let $sourceid := string($b/ancestor::tei:TEI/descendant::tei:bibl[tei:ptr[@target = 'http://syriaca.org/bibl/649']]/@xml:id)
let $a :=
<event type="attestation" xml:id="attestation{$pid}-1" source="{$sourceid}">
<p xml:lang="en"><persName ref="{$uri}">{$name}</persName> is commemorated in
<title ref="{$work-id}">{$work-title}</title>.</p> </event>
return $a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment