Hello --
I've got an element node that's part of a document. I need its position among the element children of its parent.
$step/position() will (correctly!) always return 1, there's one thing in $step, of course it does.
replace($step/path(),'^.*\[(\p{Nd}+)\]$','$1') => xs:integer()
gets me the implicit position but is something of a horror.
for $e at $in in $step/../* where $e is $step return $in
works, too, but any notion of elegance and clarity have fled screaming into the night.
I keep thinking there must be a better way; anyone got any suggestions?
I think functx has some node-index-of you could use or use e.g.
index-of($step/../*/generate-id(), generate-id($step))