Cascade select inside repeat group

I have a simple form which contains repeat groups of counties and cities.
The structure is

Cities are filtered based on the county. But adding second repeat group causes an error. Which means the expression instance('choices')/counties/county[value=/form/feature/county]/cities/city
cannot obtain the county value from the current repeat group.
I went to through the forums and read about indexed-repeat() function and using relative paths.
I tired both , but still no luck. I used a node outside repeat group to hold the county value using indexed-repeat() but that will always contain the first group's county value.
Also the relative path (../county) did not bring up any cities at all.
I tried using [value=/form/feature[position=position(..)]/county] still no result.

I would appreciate some help here.
All I want is the cities filtered on counties of the current context group.


Cascading Select Form.xml (2.09 KB)