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

Ihe Onwuka ihe.onwuka at gmail.com
Tue Apr 8 09:04:32 PDT 2014


yes, for some reason I strenuously avoid using the for version of
Flowr syntax so abandoned my attempt without considering it.

So although I like the minimalistic way you formulated the query
(sequencing over only the collection string) my curiosity is centred
on the challenge of doing it with the just / operator.

On Tue, Apr 8, 2014 at 4:54 PM, David Carlisle <davidc at nag.co.uk> wrote:
> 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
> constructing.
>
> for $c in ('myColl','myColl2') return count(collection($c)//elem)
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk


More information about the talk mailing list