xsl-list
[Top] [All Lists]

RE: Is this an XPath Grammar Limitation ?

2005-02-11 03:59:12

Michael Kay wrote:

Here are some expressions that the 1.0 syntax allows
but the data typing rules prohibit:

1/fred

fred/1

count(3)

4 | 5

Turns out Jaxen was flaking out on half of those (returning 
empty lists 
instead of throwing an exception). I've now fixed them. Are there any 
other kinds of BNF-correct but datatype-forbidden expressions 
in XPath 
1.0 I should be watching out for?

XPath 1.0 is generally designed to be free of run-time errors - i.e. if you
make a mistake it returns garbage rather than reporting an error. The only
type conversion it won't attempt is converting an atomic value (in 2.0
parlance) to a node-set. The above examples all exploit this: they are all
functions/operators that expect a node-set but are given an atomic value. I
can't offhand think of any others, except simple variations like replacing
count() by sum().

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>