Howdy -- I've run into a somewhat confusing error message using GROUP BY in BaseX 7.8.1, while trying to answer a question on StackOverflow ( http://stackoverflow.com/questions/22585865/grouping-with-counts-in-xquery).
Against the database at http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml, I'm running the following query: 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?
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk