(: cut and paste this query into your own test file :)
(:
finds act, scene and speaker of famous
line "Et tu, Brute! Then fall, Caesar."
should return
CAESAR
ACT III
SCENE I. Rome. Before the Capitol; the Senate sitting above.
:)
{
for $a in doc("j_caesar.xml")//ACT,
$sc in $a//SCENE,
$sp in $sc/SPEECH
where $sp/LINE/text() = "Et tu, Brute! Then fall, Caesar."
return ({$sp/SPEAKER/text()},
{
({$a/TITLE/text()},
{$sc/TITLE/text()})
})
}