Michael Doyle wrote:
> Using XPath, I want to get all elements FOO which are not children of
> BAR.
>
> What i have done in this instance is:
> //FOO[name(..)!='BAR']
You do not need name checks, you can simply do
//FOO[not(parent::BAR)]
> this only works when BAR is immediately below FOO,
That is what you want if your description above is correct: FOO elements
which are not children of BAR.
If you want FOO elements which are not descendants of BAR then you can use
//FOO[not(ancestor::BAR)]
--
Martin Honnen
http://JavaScript.FAQTs.com/