开发者

Child's index with XPath

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 elem开发者_开发问答ent 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜