In the following XForm, I would like to link the xf:labels (and eventually other xforms controls or values) to elements in the 'i-elementSchema' instance. I can not figure out the correct XPath to link the current element name in the xf:repeat to the matching element label in the schema. I am using XSLTForms. Any ideas?
Full test code here: https://gist.github.com/wsalesky/30ca5c0d7b6f9fdc2b3a112a1a8594f9
XForms model:
<xf:model>
<xf:instance id="i-rec">
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<handDesc hands="">
<summary/>
<handNote xml:id="" scope="" script="" mode="" quality="" medium="">
<p about="" style=""/>
<persName ref="" role=""/>
<p/>
<placeName ref=""/>
</handNote>
</handDesc>
</TEI>
</xf:instance>
<xf:instance id="i-elementSchema">
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<summary name="summary" label="Summary"/>
<handNote name="handNote" label="Hand Note"/>
<p name="p" label="Paragraph"/>
<persName name="persName" label="Person Name"/>
<placeName name="placeName" label="Place Name"/>
</TEI>
</xf:instance>
</xf:model>
XForms UI:
<xf:repeat ref="instance('i-rec')//*:handDesc/*" id="handNote">
<div class="moveInput" draggable="true">
<xf:input ref=".">
<xf:label>
<xf:output value="instance('i-elementSchema')/descendant-or-self::*[@name = local-name(.)][1]/@label"/>
</xf:label>
</xf:input>
</div>
</xf:repeat>
Answered on Twitter, use current():
instance('i-elementSchema')/descendant-or-self::*[local-name() = local-name(current())]/@label