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

Ihe Onwuka ihe.onwuka at gmail.com
Tue Apr 8 08:52:34 PDT 2014

On Tue, Apr 8, 2014 at 4:46 PM, Michael Sokolov
<msokolov at safaribooksonline.com> wrote:
> On 04/08/2014 11:23 AM, 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(.)
>> 2 collections to give me 2 numbers .C'est domage, Mais non. That only
>> gives me one number - the count of elems in MyColl.
> That should give you the total count of both.  You are thinking that you
> have a sequence of sequences, but you don't since there is no such thing in
> XPath -- only sequences of items (nodes and atomic values).

Indeed.... that tallies with what I got and was why I reached for the
map operator. Try first and ask later. That's ok for a a non critical

More information about the talk mailing list