Referencing label in repeat group iterations

Dear all,

I am creating a repeat and within the repeat I first ask a select_multiple question and then followed by a rank question. I would like to have within the next repeat (based on the number of answers in the multiple selection) to show the answer of the rank question in the label for the next select_one question. You can find the ODK form here:
Trial_errors.xlsx (16.4 KB).

This calculation does not work properly as I would like to see: jr:choice-name(selected-at(${rank_structureType},position(..)-1),'${structureType}')

When deploying the form, you can see the first choice will pop up in the label, but not the next choice from the rank question. Could you assist me to fix this problem?

Many thanks in advance!

Also, https://support.kobotoolbox.org/creating-forms/group_repeat.html is not working properly:

@Webex, maybe this is something you are looking for that has already been discussed previously:

Dear Kal_Lam,

Thanks for the information! I have compared the section in my ODK form with the one that is that can be found in the Household (count) Repeat Example.xlsx:

Mine: jr:choice-name(selected-at(${rank_structureType},position(..)-1),'${structureType}')
Household: jr:choice-name(selected-at(${Q1}, position(..)-1), '${Q1}')

They are similar, so that was not the problem. Thus, I deleted as much as I could to find the problem.

After relocating the row with the calculation of the rank question into the repeat question, the problem was solved.

From:

To

Why should this calculation be present in the repeat question instead just before the start of the repeat question?