On Wed, Jan 8, 2014 at 11:20 AM, David Carlisle <dav...@nag.co.uk> wrote:

> On 08/01/2014 11:11, Ihe Onwuka wrote:
>
>>
>>
>>
>> On Wed, Jan 8, 2014 at 11:03 AM, David Carlisle <dav...@nag.co.uk
>> <mailto:dav...@nag.co.uk>> wrote:
>>
>>     On 08/01/2014 09:35, Ihe Onwuka wrote:
>>
>>               >
>>               >  <person>{$thing/@name}</__person>
>>
>>
>>
>>         I can't begin to fathom the rationale for the exception or the
>>         value of
>>         such an exception over the simple rule of atomizing sequences if
>>         they
>>         appear in contexts where a value is expected.
>>
>>
>>     why do you think an atomised value is expected here?
>>
>>
>> because the value you put in an attribute must be atomic.......
>>
>
> If you add such a sequence in an attribute constructor then it is
> atomized, but here you are copying a sequence of nodes into an element
> constructor. In particular you are adding attribute nodes.
>

I may have confused things by getting my brackets wrong. If I did.

<abc cnt='johnny'>be good</abc>/<def>{@cnt}</def>

constructs a def element with a cnt attribute. the expression inside <def>
</def> is an attribute constructor. I expect it to be atomized for the
previously given reasons.


>

>>     would you expect element nodes
>>
>>
>>       <person>{$thing/name}</person>
>>
>>     to be atomised as well? (They aren't: this would add a sequence of
>>     <name> children to <person>)
>>
>>
>> ......and the value of an element doesn't have to be.
>>
>
> You are copying a sequence of nodes so that <person> becodes their parent,
> attribute and element nodes are treated similarly.
>

It's not really what they are it's what the receptacle of what I am copying
into expects.


>
>
>>
>>
>>      >  It seems to me that it is
>>
>>         just demanding the explicit call of the  data function (which is
>>         exactly
>>         what I put in) for something it could just have easily handled
>>         implicitly.
>>
>>
>>     But this construct is designed to add attribute nodes, so implicit
>>     atomization would be undesirable.
>>
>>
>> Why? It cannot be a placeholder for anything but an  atomic value.
>>
>
> No, as shown here it is copying attribute nodes. If $thing is
>
> <foo name="me"/>
>
> then
>
>  <person>{$thing/@name}</person>
>
> is
>
>  <person name="me"></person>
>

exactly


>
> but
>
>
>  <person>{$thing/@name/string()}</person>
>
> is
>
> <person>me</person>
>
>
so by putting the string() function on the end it is no longer
constrtucting an attribute. I have no problem with that.



> You are (I think) saying that atomization should be automatic and you
> should get the second result, but then you would not be able to copy
> attribute (or element) nodes.
>
>

No. I am saying that if the expression is an attrtibute constructor then
atomization should be atomic.

 <person>{$thing/@name/string()}</person>

is not an attribute constructor. It is an expression derived from an
attribute.
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk

Reply via email to