Correct use of indexed-repeat

Dear group,

I am setting up a survey in which I use a repeat group to collect data on
individuals within a household. Within this repeat group, I use another
nested group (table appearance) regarding specific properties of each
individual.

At the end of my survey I included yet another repeat group for which I
want do use the data stored in the above mentioned nested group as a
constraint. I tried to use index repeat to do this but I cant get it to
work. I guess my understanding of the indexed-repeat function is not
sufficient to do this.

My aim is to iterate over a group (called: ../persons/) and then to
extract the value of a second-order sub-item of that group (
/persons/_ns_smpt/_nscase_cc)

I have tried the following:

indexed-repeat(/MUN_2016_vs5/Screening/persons/_ns_smpt/_nscase_cc,
/MUN_2016_vs5/Screening/persons/_ns_smpt, 1,
/MUN_2016_vs5/Screening/persons, position(..)) = 1

This gives the same answer for all repeats and seems to refer to the first
item during each iteration.

Unfortunately I cant find documentation or examples on how to do this. help
would be greatly appreciated.

cheers, Ente

Question.xls (128 KB)