Skip to content

Instantly share code, notes, and snippets.

@fordmadox
Created June 15, 2014 19:24
Show Gist options
  • Save fordmadox/72e7e548c9e5f64f84ef to your computer and use it in GitHub Desktop.
Save fordmadox/72e7e548c9e5f64f84ef to your computer and use it in GitHub Desktop.
declare namespace tei="http://www.tei-c.org/ns/1.0";
<results>
{
for $actor-list in //tei:stage/@who,
$actor in $actor-list/tokenize(., ' ')
group by $actor
order by $actor
return
<actor> {
attribute name { substring-after($actor, '#') },
attribute total-speeches {count(//tei:sp/@who[. eq $actor])},
for $actor in $actor-list
let $key := $actor/concat(ancestor::tei:div1/@n,'.',ancestor::tei:div2/@n)
group by $key
order by $key
return
<act_scene>{ attribute speech-count {count($actor/ancestor::tei:div2//tei:sp/@who[. = $actor-list])}, $key }</act_scene>
}
</actor>
}
</results>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment