Getting lists of name variants
Posted by mholmes on 27 Jan 2011 in Activity log
To assist KSW with automating some of the name markup, I've been generating lists of distinct values for name variants, using this code:
xquery version "1.0";
declare namespace xdb="http://exist-db.org/xquery/xmldb";
declare namespace util="http://exist-db.org/xquery/util";
declare namespace f="http://exist-db.org/f-functions";
declare namespace tei="http://www.tei-c.org/ns/1.0";
(:declare namespace fn="http://www.w3.org/2005/xpath-functions";:)
declare function f:getContents($id as xs:string) as element()*
{
for $d in distinct-values(collection('/db/coldesp/correspondence/')//tei:name[not(@type)][@key = $id])
return
<name>{$d}</name>
};
<people>
{for $id in distinct-values(collection('/db/coldesp/bios/')//tei:person/@xml:id)
return
<person xml:id="{$id}">
{f:getContents($id)}
</person>}
</people>
Throws up some interesting things that look like they might be typos, as well as many names that don't seem to have any mentions in the text. I'm investigating.