Background:
Building a form (using XSLTForms) that is submitted, then the user may resubmit at a later date. We want the user to see the values of their previous submission next to the form input, so we're loading 2 instances 'data-set' and 'old-data-set'. This is working in most instances, but not where we have repeats. for whatever reason the position() method always returns '1' when calling data from the 'old-data-set' instance. For example:
<xf:repeat nodeset="instance('data-set')/references/reference">
<xf:group ref=".">
<xf:label>Reference <xf:output value="position()"/></xf:label>
<xf:input ref="/org_name">...</xf:input>
<xf:output ref="instance('old-data-set')/references/reference[position()]/org_name"/>
</xf:group>
</xf:repeat>
The position() method works in the label, but always returns '1' when attempting to get the value from the second instance. For example the above produces:
<label>Reference 1</label>
<input>Org name 1</input>
<output>Old org name 1</output>
<label>Reference 2</label>
<input>Org name 2</input>
<output>Old org name 1</output>
<label>Reference 3</label>
<input>Org name 3</input>
<output>Old org name 1</output>
How can I call the position() of the repeat so I can use it to get the correct value from the 'old-data-set' instance?