Re: [xsl] [XPath 1.0] Why is .[A] illegal but self::node()[A] is legal?

Subject: Re: [xsl] [XPath 1.0] Why is .[A] illegal but self::node()[A] is legal?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Sat, 07 Aug 2010 18:01:27 +0100
On 07/08/2010 16:17, Costello, Roger L. wrote:
Hi Folks,

Why is this XPath 1.0 expression illegal:

.[A]

whereas this XPath 1.0 expression is legal:

self::node()[A]


Isn't '.' a shorthand for 'self::node()'? Shouldn't I be able to interchange the two in any expression?



I think the most likely explanation is that disallowing .[A] in XPath 1.0 was an unintentional mistake, an unforseen consequence of the way the grammar rules were written. At any rate, I never encountered anyone who put forward a rationale for it, or who suggested that it was a deliberate design choice.


Michael Kay
Saxonica

Current Thread