On Wed, Jan 8, 2014 at 9:14 AM, Michael Kay <[email protected]> wrote:
> Could you explain where you think these two definitions differ? > > Your book says atomization is invoked implicitly when a SEQUENCE is used where ATOMIC VALUES are expected. The specification says Atomization is applied to a value when the VALUE is used in a context in which a SEQUENCE of atomic values is required. > As far as I can tell, your confusion is about whether atomization is > invoked in a particular context, not about what atomization actually does. > > yup. If I end up (implicitly) with a sequence of nodes in an expression sourcing an output attribute that looks to me like a SEQUENCE where an ATOMIC VALUE is expected. Incidentally that was what I was expecting before eXist barfed on me. Said barfing caused me to look up the XPath data() function whereupon I saw the definition in your book and thought ...hang on, this should have been atomized implicitly. > In particular, atomization is NOT invoked in XQuery when you use a > construct of the form: > > > > > <person>($thing/@name)</person> > > This is a very common source of confusion and programming mistakes. > However, in terms of the specifications you cite: > > (a) The XQuery specification (correctly) does not include embedded > expressions in its list of contexts where atomization takes place > > 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. 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. > (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. > Michael Kay > Saxonica > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk >
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
