counting the preceding cousins of an element
Hi,
I am trying to get the number of preceding cousin of an element but I can't seem to work on it.
I tried using the axes but I guess it could not reference the same ancestor. For example,
<chapter>
<para>
some text here
<footnote>
some text here
<footnote>
</para>
<para>
some text here
<footnote>
some text here
<footnote>
some text here
<footnote>
some text here
<footnote>
</para>
<para>
some text here
<footnote>
some text here
<footnote>
</para>
</chapter>
<chapter>
...
</chapter>
<chapter>
...
</chapter>
In this example, the footnote is the element and the ancestor is the chapter.
How can I find the preceding::footnote[ancestor::chapter[descendant::"is the current node"]]?
Thanks,
Carlo
|