Skip to content

Instantly share code, notes, and snippets.

@jonathanrobie
Last active August 29, 2015 14:02
Show Gist options
  • Save jonathanrobie/a43b38d8ec48f83d081e to your computer and use it in GitHub Desktop.
Save jonathanrobie/a43b38d8ec48f83d081e to your computer and use it in GitHub Desktop.
declare default element namespace "http://www.tei-c.org/ns/1.0";
(:
Which scene does each actor appear in?
- group by actors (need a variable that iterates over actors)
- need another variable that is bound to the scene
:)
for $scene in //div2[@type='scene']
for $whoville in $scene//*[@who]
for $person in
for $s in $whoville/@who
return tokenize($s, " ")
group by $person
order by $person
return
<person xml:id="{$person}">
{
for $s in $scene/@n
group by $s
order by $s
return xs:integer($s)
}
</person>
@jonathanrobie
Copy link
Author

Query from http://xqueryinstitute.org/ workshop, June 2014. Input is Folger's edition of Julius Caesar.

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