Skip to content

Instantly share code, notes, and snippets.

@davidamichelson
Created July 16, 2015 15:26
Show Gist options
  • Save davidamichelson/857733cac083c270013b to your computer and use it in GitHub Desktop.
Save davidamichelson/857733cac083c270013b to your computer and use it in GitHub Desktop.
xquery version "1.0";
declare namespace tei="http://www.tei-c.org/ns/1.0";
let $langs := ("syr", "syr-Syrn", "syr-Syrj", "en", "en-x-gedsh")
let $doc := fn:doc("13.xml")
for $person in $doc//tei:person
let $uri := $doc//tei:person//tei:idno/text()
for $name in $person/tei:persName
let $names := $name//text()[. = normalize-space(.)]
let $lang :=$name/@xml:lang/string()
where $name/@xml:lang = $langs
return
<row>
<uri>{$uri[1]}</uri>
<names>{fn:string-join($names, ",")}</names>
<lang>{$lang}</lang>
</row>
@davidamichelson
Copy link
Author

If there is a Syriac name, then export the following:
All Syriac names with language tags (and join name parts)
All English names with language tags (note need to normalize space and join name parts)
The URI for the person

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