[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Is this an XPath Grammar Limitation ?


Subject: RE: [xsl] Is this an XPath Grammar Limitation ?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 11 Feb 2005 10:59:12 -0000

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


Current Thread
Keywords