2

I'm hacking the OOXML format with XPath and it contains some 0-based arrays.

What I want to do is get the indices of individual elements.

For example:

<parentNode>
    <childNode type="string" />
    <childNode type="integer" />
    <childNode type="boolean" />
</parentNode>

Here I can find the desired element with the expression "//childNode[@type='boolean']"; now I only need to find it's index with XPath somehow (in this case the index should be 2).

Please advise.

akosch
  • 4,326
  • 7
  • 59
  • 80

1 Answers1

3

I would think you should be able to use position() function, but this thread might be helpful to you:

Find position of a node using xpath

Community
  • 1
  • 1
limc
  • 39,366
  • 20
  • 100
  • 145