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

David Carlisle davidc at nag.co.uk
Wed Jan 8 03:03:38 PST 2014


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? 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>)


 >  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.

>     (b) This construct is specific to XQuery, and therefore outside the
>     scope of my XSLT/XPath book.
>
>
> My paradigm is the possibly incorrect formula that XQuery 1.0 is a
> superset of XPath 2.0 that I have seen bandied about.
>


XQuery has syntax changes but this is the same as XSLT/XPath 1

<person>
   <xsl:copy-of select="$thing/@name"/>
</person>

which would add attribute nodes to the person element.

David


________________________________________________________________________
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