Howdy --
for $line in //SPEECH/LINE
let $speaker := $line/../SPEAKER/text()[1]
group by $speaker
return <speaker name="{$speaker}" count="{count($line)}"/>
...and receiving the error:
[XPTY0004] Single item expected, (db:open-pre("hamlet",748), db:open-pre("hamlet",750)) found.
I've gone over the GROUP BY docs several times, and not seeing my error in the above. Could someone enlighten?