-2

在下面的 XForm 中,我想将 xf:labels(以及最终的其他 xforms 控件或值)链接到“i-elementSchema”实例中的元素。我无法找出正确的 XPath 将 xf:repeat 中的当前元素名称链接到模式中的匹配元素标签。我正在使用 XSLTForms。有任何想法吗?

完整的测试代码在这里:https ://gist.github.com/wsalesky/30ca5c0d7b6f9fdc2b3a112a1a8594f9

XForms 模型:

<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 用户界面:

<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>
4

1 回答 1

0

在 Twitter 上回答,使用 current():

instance('i-elementSchema')/descendant-or-self::*[local-name() = local-name(current())]/@label
于 2022-02-02T21:30:20.267 回答