On Wed, Jan 8, 2014 at 12:07 PM, David Carlisle <dav...@nag.co.uk> wrote:

> On 08/01/2014 11:55, Ihe Onwuka wrote:
>
>>
>> for $t in things/thing group by $sex:=$t/@sex return
>> <something>{$t/@sex}</something>
>>
>> the effect of the group by turns {$t/@sex} into a sequence of
>> attribute nodes and the processor (at least eXist) will barf about
>> duplicate attributes instead of atomizing them. Why barf - duplicate
>> atttributes are not allowed and demand an explicit atomization?
>>
>
>
> because atomising would just be weird.
>
>
It's looks weird because I used a crap example but in my real scenario  it
is exactly what I wanted it to do. In fact if your plan is to subsequently
count and/or union/interstect the atomized values or return a the list of
them,  it is not weird at all.

Furthermore atomizing it makes explicitly clear to the programmer whats
gone on whereas barfing about duplicate attribute nodes when what you have
coded

<something>{$t/@sex}</something>

has no  explicit duplicate node in sight is bloody confusing until you
figure out that the duplicates have mysteriously morphed from the group by
clause. Note this can happen even if your are grouping on something other
than @sex.
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to