My sample input XML is:
item item1 item2 item3
you can use this:
/root/a/b[position()=$variable]
position() is 1 based
http://saxon.sourceforge.net/saxon6.5.3/expressions.html
The following should work:
/root/a/b[2]
And if it doesn't, try:
/root/a/b[position()=2]