There are two solutions to your problem:
1. Avoid the additional select attribute, so that the position() in the
span "sees" the position of the div:
<div select="item" values="class:ext-if(position() mod 2 =
0,'white','green')">
<span values"id:position()" content="name"></span>
</div>
2. Remember the position() of the div in a variable and use the
variable in the span:
<div select="item" values="class:ext-if(position() mod 2 =
0,'white','green');$position:position()">
<span select="name" values"id:$position" content="."></span>
</div>
The XPath function position() returns the position of the current node
in the current node set. Every select attribute establishes a context
with a new node set in which XPath expressions are evaluated.