Orbeon 表单 - 引用模板部分之外的控件值

问题描述

使用 Orbeon Forms,我有一个包含嵌入式模板(库)部分的表单。我需要从主窗体中的控件检索值到模板部分中的控件。我发现了一些关于模板部分类似问题的对话。

这听起来与我的情况基本相同: http://discuss.orbeon.com/Retrieve-value-outside-library-section-template-td4663317.html

建议的方式没有按预期工作。建议使用函数 xxf:instance(),例如 xxf:instance('fr-form-instance')/mysection/mycontrol 应该可以工作。但是,当我将这样的函数添加到库内的控件时,我无法获得库部分外的参考点。

为了调试,我在库部分控件中运行了命令:saxon:serialize(xxf:instance('fr-form-instance'),'xml')。这仅返回了仅包含主表单的库部分部分的部分的 XML,基本上如下所示:

<library-section>
    <grid>
        <controlInLibrary>Control value blah blah</controlInLibrary>
    </grid>
</library-section>

如果我在主表单部分运行相同的命令,我会得到整个表单,包括库部分:

<form>
    <another-section>
        <grid-another>
            <control1/>
            <control2/>
        </grid-another>
    </another-section>
    <library-section>
        <grid>
            <controlInLibrary>Control value</controlInLibrary>
        </grid>
    </library-section>
</form>

显然,这里的示例 XML 已经过简化。

这个 xxf:instance() 函数应该如何工作以获取库外的数据?我可能做错了什么?

根据另一个线程,我让它以相反的方式工作(从模板部分控件到主表单控件的数据),但显然这两种方式都不起作用: Orbeon Form Builder - Referring to a control within a Section Template

解决方法

从其他地方的 Orbeon 支持那里得到了答案。至少在我的情况下,工作解决方案是该函数的形成方式如下:

xxf:instance('|fr-form-instance|')//outer-field

(//outer-field 显然是对主窗体上所需控件的引用。)