[
Lists Home |
Date Index |
Thread Index
]
Hi Garland,
> Return all the "b" nodes that are inmediately preceded by an "a"
> element (the bold nodes).
Use:
/foo/b[preceding-sibling::*[1][self::a]]
preceding-sibling::*[1] gets you the immediately preceding element;
the [self::a] predicate tests whether the element that you select is
an 'a' element or not.
It's better doing it this way than using local-name() because it deals
properly with namespaces (i.e. it looks for 'a' elements in no
namespace rather than all elements that are called 'a' no matter what
namespace they're in).
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
- References:
- Quick Xpath
- From: "Garland foster" <garland_foster@salutia.com>
|