OK. So the 'problem' you are witnessing in your form is a consequence of the fact that you have an inner group within your repeat group, inside of which you are using selected-at(). As a consequence, when you perform
'..' is basically jumping up one group level to figure out which iteration it is in. Normally, that is when you are directly inside a repeat group, this corresponds to the repeat iteration (1,2,3,4...). However, because you are using it within a (single) inner group,
position(..) is always going to return 1 (!). Hence why you keep getting that dang First Team Name!
The workaround in your case is to jump up another level so that the position() function actually gets the correct iteration that you are in; that is
OK. I realize this might be getting a bit over your head, but dont worry! We're getting pretty down-n-dirty into obscure XPath stuff here, but it is probably worth explicitly documenting in case other's fall into your same trap (@ln?):
if you try to use position(..) - to find out what iteration your are in - you must be immediately within the encompassing repeat group, otherwise you'll get an invalid index (probably always 1...)
To answer your immediate problem, try this form instead, which - like yours - has a group within a repeat group:
selectrepeat2.xls (20 KB)