W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2004

RE: [XPath 2.0] XPath 1.0 Compatibility Mode doesn't cover fn:number

From: Michael Kay <mhk@mhk.me.uk>
Date: Fri, 30 Apr 2004 09:27:33 +0100
To: "'Don Chamberlin'" <chamberl@almaden.ibm.com>, "'Priscilla Walmsley'" <priscilla@walmsley.com>
Cc: <public-qt-comments@w3.org>
Message-Id: <20040430082817.2A498A1454@frink.w3.org>
Don Chamberlin wrote: 
 The revised rules for function argument conversion in XPath 1.0
compatibility mode are as follows: 

If XPath 1.0 compatibility mode is true and the argument is not of the
expected type, then the following conversions are applied sequentially to
the argument value V: 
1. If the expected type calls for a single item or optional single item
(examples: xs:string, xs:string?, xdt:untypedAtomic, xdt:untypedAtomic?,
node(), node()?, item(), item()?), then the value V is effectively replaced
by V[1]. 
It's also worth pointing out section 2.5.3 which contains the statement:
Similarly, in evaluating an expression, an implementation is not required to
search for data whose only possible effect on the result would be to raise
an error 
My reading of this statement is that when 1.0 compatibility mode is off,
supplying a sequence of more than one item to a function that expects a
singleton is an error that the implementation is not required to detect. For
example, if you write string(//TITLE), the implementation is allowed to give
you the string value of the first TITLE in the document, without searching
the rest of the document to see if there are any more, as the only effect of
this search on the result would be to raise an error. So the XPath 1.0
first-item rule is still there, albeit in a deprecated kind of way. I
mention this because a number of people have expressed concerns about the
performance implications of dropping the first-item rule.
Michael Kay (speaking personally) 
Received on Friday, 30 April 2004 04:28:17 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:19 UTC