RE: [xsl] Error in XPath expression with IE

Subject: RE: [xsl] Error in XPath expression with IE
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Tue, 15 Mar 2005 16:31:32 -0000
> Maybe this is a little of-topic, but i have this problem
> where the expression
>
> (//Menu)[1]ancestor-or-self::Menu/MenuTitulo
>
> gives a error on some IE browsers

That is because it's missing a '/' after the predicate:

(//Menu)[1]/ancestor-or-self::Menu/MenuTitulo
          ^^^

[snip]

> Can i write this XPATH expression withou the use of the axis?

The Xpath itself isn't very good because (//Menu)[1] selects the first
<Menu> element of all <Menu> elements in the whole document, returning
at most a single node.  The ancestor-or-self::Menu axis on that node
will only ever return that same node back, so:

(//Menu)[1]/ancestor-or-self::Menu/MenuTitulo

Is the same as:

(//Menu)[1]/MenuTitulo

cheers
andrew

Current Thread