[xquery-talk] Tales of the unexpected version III - Atomization

David Carlisle davidc at nag.co.uk
Wed Jan 8 08:22:43 PST 2014

On 08/01/2014 15:38, Ihe Onwuka wrote:
> because it is going to end up (by whatever process) as an attribute
> node.

That seems to be the cause of your confusion (and your misreading of the
spec and Mike Kay's book) If you go <foo>{$d/@*}</foo> You are _not_
copying nodes to a context where atomic values are expected, you are
copying them to an element node constructor, which is expecting nodes.

If the sequence were atomized (implicitly or by explicit use of data()
or string() then it would not "end up by any process as an attribute
node", it would make text node child of the element (which is why I
assumed originally that was what you intended to generate).

Implicit atomization would do the same as


and the odd thing is you have said repeatedly that data() solved your
problem, but that will not generate any attribute nodes, the values of
the attributes will be concatenated as text node child of <foo>.

Had you gone <foo bar="{$d/@*}"/> then you are copying to such a
context, and atomization would be automatic and you would get the result
you want.

The FLWOR expression and group by clause are not really
relevant to the issue, you get the same behaviour (and same error
messages) without any grouping.


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

More information about the talk mailing list