Skip to content

Instantly share code, notes, and snippets.

@fordmadox
Last active August 29, 2015 14:02
Show Gist options
  • Save fordmadox/d5b46fa6901f62916dc3 to your computer and use it in GitHub Desktop.
Save fordmadox/d5b46fa6901f62916dc3 to your computer and use it in GitHub Desktop.
declare namespace tei = "http://www.tei-c.org/ns/1.0";
(: for each actor, give a list of the scenes that they appear in :)
for $actor in //tei:div2[@type="scene"]//tei:sp/tei:speaker/tei:w
let $scene := concat($actor/ancestor::tei:div1/tei:head/normalize-space(.), ', ', $actor/ancestor::tei:div2/tei:head/normalize-space(.))
group by $actor
order by count(distinct-values($scene)) descending
return
<actor name="{$actor}">
{
for $s in distinct-values($scene)
return
<scene>
{$s}
</scene>
}
</actor>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment