Position(..) function in repeat

Dear reader,

I have a question regarding the position(..) function in a repeat question.

If you use select_multiple in a begin group, it is possible summoning the reference of choices in the calculation column or in the label column with selected-at(string list, number index)(https://getodk.github.io/xforms-spec/#fn:selected-at) , but how to do this for a repeat?

I have heard of using position(..) in the ‘calculation’ column and use a calculate type question to store the data. See this excel file for more info:
Trial_errors.xlsx (13.6 KB). Here, I ask how many repeats you want to have and using the repeat-count gives that amount of repeats. After that, you start with the first repeat with a text in the label column with ${layers_position_1} displaying ‘1’, second repeat will display ‘2’ etc depending on the number of repeats.

I do not fully understand how the position(..) function above works. The following information can be found: Deviates from XPath 1.0 in that it accepts an argument. This argument has to be a single node. If an argument is provided the function returns the position of that node amongst its siblings (with the same node name). Does it imply that this function works similarly as selected-at(string list, number index)? Could I have used this alternative function in Trial_errors.xlsx instead of jr:choice-name(selected-at(${rankCoarse},0),'${coarseSize}'), where the ‘0’ refers to the stored value in the variable?

I hope that an answer may clarify this. Thanks in advance!

@Webex, you should be able to learn more about the position function here.