Re: [docbook-apps] Identify first <section>?

From
John L. Clark <>
Date
2003-12-10T19:07:51+00:00
ID
Thread
Re: [docbook-apps] Identify first <section>?
On Wed, Dec 10, 2003 at 06:40:15PM +0000,  wrote:
> Unfortunately I'm still not getting anywhere.
> 
> test="not($node/preceding-sibling::section)" does actually check all 
> sibling elements before node right? ie. in:
> 
> <chapter>
>    <title>
>    <chapterinfo>..</>
>    <section>                <-- if here
>    <section>
> 
> ..will check <title> and <chapterinfo> to return "true"?

I think the spec[0] has a revealing example for this:

* preceding-sibling::chapter[position()=1] selects the previous chapter
  sibling of the context node

So I think your XPath expression checks to see if there are any
preceding section siblings, not /any/ siblings.  I think you'd want
something like:

    not($node/preceding-sibling::*)

But that's untested.

Good luck!

Take care,

    John L. Clark

[0] http://www.w3.org/TR/xpath