I'm trying to find the position of the <b>
element (which I'd expect to be 2) in the below XML using XSLT:
<root>
<a>
...
</a>
<b>
...
</b>
</root>
I'm trying to retrieve this value during a for-each loop through root/*
.
Based on this similar question, I've tried using: count(root/b/preceding-sibling::*)+1
but all I seem to get is the value '1'. Can anyone spot what I'm doing wrong here?