[xsl] Not So Newbie XPath Question

Subject: [xsl] Not So Newbie XPath Question
From: Bernard Harrison <b_harrison@xxxxxxxxxxxxx>
Date: Tue, 20 Feb 2001 00:00:10 +1100
I have an XML structure of the following form:

<z>
    <m/>
    <n/>
    <o/>
    <a/>
    <a/>
    <a/>
    <xp/>
    <xq/>
    <xr/>
</z>

In the above structure is a sample. In the XML I will be dealing with there is an
arbitrary number of child elements of "z".
Amongst the child elements there is a sequence of zero or more "a" elements.
I need an XPath expression to select/match the first element after this sequence
of "a" elements(if present). The first element's name after the "a" sequence is unknown.
In the above example it just happens to be "xp"

Is the following the most reasonable way to do it?

z/*[preceding-sibling::a and not(self::a)][position() = 1]

I have tested it and it seems to be ok. (Just does not seem that intuitive)

Any thoughts appreciated,
Bern

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread