Subject: RE: [Xpath] Finding the *first* preceding sibling
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 4 Apr 2003 16:20:29 +0100
|
I tried
> '/para/node()[preceding-sibling::blink[1]]' but it gives
> exactly the same set of nodes.
>
> What did I miss in the Xpath specification?
>
If a node has a preceding sibling called "blink", then one of these will
be the first, so the two conditions are equivalent.
You want to test whether the first preceding sibling is called "blink":
[preceding-sibling::*[1][self::blink]]
Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|