[xquery-talk] A walk down Sesame St - counting for simpletons

David Carlisle davidc at nag.co.uk
Tue Apr 8 08:54:37 PDT 2014

On 08/04/2014 16:23, Ihe Onwuka wrote:
> count(colllection('myColl')//elem tells me how many elems there are in
> myColl. Fine
> So now I want to be told how many elems are in myColl and myColl2.
> Put them in a sequence like so
> (collection('myColl')//elem,collection('myColl2')//elem) and then
> apply the count method to each element of the sequence n'est pas?
> (collection('myColl')//elem,collection('myColl2')//elem)/count(.)

XPath sequences don't nest ((1,2,3),(4,5,6)) is (1,2,3,4,5,6) so your 
issue is nothing to do with count() but rather with the sequence you are 

for $c in ('myColl','myColl2') return count(collection($c)//elem)

More information about the talk mailing list