Orbeon Xforms 嵌套重复 [英] Orbeon Xforms nested repeats

查看:40
本文介绍了Orbeon Xforms 嵌套重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个在 Orbeon 服务器中运行的带有嵌套重复的表单.这个想法是在第一个元素中包含一些可以重复的元素和其他元素,这些元素也可以重复.即用于插入个人信息的块(对于重复中的几个人),并且对于每个人,我们可以添加多个电话号码(也是重复).

I am trying to create a form with nested repeats that runs in Orbeon server. The idea is to have some elements that can be repeated and other elements inside the first one, that also can be repeated. i.e a block for inserting personal information (for several persons in a repeat) and for each person, we can add several phone numbers (also a repeat).

我还没有找到太多关于如何做的信息,我想我可以创建这个:其他 StackOverflow 问题(但这个例子也不适用于我,即使在评论中公开了更正).

I have not found so much information about how to do it, and I suppose that I can create this: Other StackOverflow question (but this example also does not work for me, even with the corrections exposed in the comments).

为了测试,我创建了下一个表单:

For testing I have created the next form:

<xh:html xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:odt="http://orbeon.org/oxf/xml/datatypes"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:saxon="http://saxon.sf.net/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xpl="java:org.orbeon.oxf.pipeline.api.FunctionLibrary"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
<xh:head>
    <xh:title>LoopInLoop</xh:title>
    <xf:model id="fr-form-model" xxf:expose-xpath-types="true">
        <xf:instance id="fr-form-metadata" xxf:readonly="true">
            <metadata>
                <application-name>DHszw</application-name>
                <form-name>LoopInLoop</form-name>
                <title xml:lang="en">LoopInLoop</title>
                <description xml:lang="en">Description of the form.</description>
            </metadata>
        </xf:instance>
        <xf:instance id="fr-form-instance">
            <form>
                <category-1>
                    <subcategory-1-1/>
                    <loop-group-0>
                        <loop-0>
                            <loop-group-0-0>
                                <loop-0-0>
                                <element-1-1-1/>
                                <element-1-1-2/>
                                </loop-0-0>
                            </loop-group-0-0>
                            <element-1-1-3/>
                            <element-1-1-4/>
                        </loop-0>
                    </loop-group-0>
                    <element-1-1-5/>
                </category-1>
            </form>
        </xf:instance>
        <xf:bind id="fr-form-binds"
            ref="instance('fr-form-instance')" xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel">
            <xf:bind id="category-1-bind" name="category-1" ref="category-1">
                <xf:bind id="subcategory-1-1-bind"
                    name="subcategory-1-1" ref="subcategory-1-1"/>
                <xf:bind id="group-loop-0-bind"
                    name="group-loop-0-bind" ref="loop-group-0">
                    <xf:bind id="loop-0-bind" name="loop-0" ref="loop-0">
                        <xf:bind id="group-loop-0-0-bind"
                            name="group-loop-0-0-bind" ref="loop-group-0-0">
                            <xf:bind id="loop-0-0-bind"
                                name="loop-0-0" ref="loop-0-0">
                                <xf:bind id="element-1-1-1-bind"
                                name="element-1-1-1" ref="element-1-1-1"/>
                                <xf:bind id="element-1-1-2-bind"
                                name="element-1-1-2" ref="element-1-1-2"/>
                            </xf:bind>
                        </xf:bind>
                        <xf:bind id="element-1-1-3-bind"
                            name="element-1-1-3" ref="element-1-1-3" relevant="(../$element-1-1-2='no' )"/>
                        <xf:bind id="element-1-1-4-bind"
                            name="element-1-1-4" ref="element-1-1-4" relevant="(../$element-1-1-2='no' )"/>
                    </xf:bind>
                </xf:bind>
                <xf:bind id="element-1-1-5-bind"
                    name="element-1-1-5" ref="element-1-1-5" relevant="($element-1-1-4='no' )"/>
            </xf:bind>
        </xf:bind>
        <xf:instance id="fr-form-attachments">
            <attachments>
                <css filename="" mediatype="text/css" size=""/>
                <pdf filename="" mediatype="application/pdf" size=""/>
            </attachments>
        </xf:instance>
        <xf:instance id="fr-form-resources" xxf:readonly="false">
            <resources>
                <resource xml:lang="en">
                    <category-1>
                        <label><![CDATA[new category]]></label>
                    </category-1>
                    <subcategory-1-1>
                        <label><![CDATA[<b>new sub-category</b><hr>]]></label>
                        <hint/>
                        <alert><![CDATA[]]></alert>
                    </subcategory-1-1>
                    <element-1-1-1>
                        <label><![CDATA[Add something]]></label>
                        <hint><![CDATA[]]></hint>
                        <alert/>
                    </element-1-1-1>
                    <element-1-1-2>
                        <label><![CDATA[More Loops?]]></label>
                        <hint><![CDATA[]]></hint>
                        <alert/>
                        <item>
                            <label><![CDATA[yes]]></label>
                            <value><![CDATA[yes]]></value>
                        </item>
                        <item>
                            <label><![CDATA[no]]></label>
                            <value><![CDATA[no]]></value>
                        </item>
                    </element-1-1-2>
                    <element-1-1-3>
                        <label><![CDATA[AddOtherThing]]></label>
                        <hint><![CDATA[]]></hint>
                        <alert/>
                    </element-1-1-3>
                    <element-1-1-4>
                        <label><![CDATA[MorewLoop2]]></label>
                        <hint><![CDATA[]]></hint>
                        <alert/>
                        <item>
                            <label><![CDATA[yes]]></label>
                            <value><![CDATA[yes]]></value>
                        </item>
                        <item>
                            <label><![CDATA[no]]></label>
                            <value><![CDATA[no]]></value>
                        </item>
                    </element-1-1-4>
                    <element-1-1-5>
                        <label><![CDATA[group.End]]></label>
                        <hint><![CDATA[]]></hint>
                        <alert/>
                    </element-1-1-5>
                </resource>
            </resources>
        </xf:instance>
        <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
            <response/>
        </xf:instance>
       <xf:instance id="loop-0-template" xxf:readonly="true">
            <loop-0>
                <element-1-1-1/>
                <element-1-1-2/>
                <loop-0-0/>                    
            </loop-0>
        </xf:instance>
        <xf:instance id="loop-0-0-template" xxf:readonly="true">
            <loop-0-0>
                <element-1-1-3/>
                <element-1-1-4/>
            </loop-0-0>
        </xf:instance>
    </xf:model>
</xh:head>
<xh:body>
    <fr:view>
        <fr:body xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
            xmlns:oxf="http://www.orbeon.com/oxf/processors"
            xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl">
            <fr:section bind="category-1-bind" id="category-1-control">
                <xf:label ref="$form-resources/category-1/label"/>
                <xh:tr>
                    <xh:td>
                        <xf:output bind="subcategory-1-1-bind" id="subcategory-1-1-control">
                            <xf:label mediatype="text/html" ref="$form-resources/subcategory-1-1/label"/>
                            <xf:hint ref="$form-resources/subcategory-1-1/hint"/>
                            <xf:alert ref="$fr-resources/detail/labels/alert"/>
                        </xf:output>
                    </xh:td>
                </xh:tr>
                <xf:group bind="group-loop-0-bind" id="group-loop-0-control">
                    <fr:grid bind="loop-0-bind" id="loop-0-control"
                        max="10" min="1"
                        origin="instance('loop-0-template')" repeat="true">
                        <xf:group bind="group-loop-0-0-bind" id="group-loop-0-0-control">
                            <fr:grid bind="loop-0-0-bind"
                                id="loop-0-0-control" max="10"
                                min="1"
                                origin="instance('loop-0-0-template')" repeat="true">
                                <xh:tr>
                                <xh:td>
                                <xf:input
                                bind="element-1-1-1-bind" id="element-1-1-1-control">
                                <xf:label ref="$form-resources/element-1-1-1/label"/>
                                <xf:hint ref="$form-resources/element-1-1-1/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                </xf:input>
                                </xh:td>
                                </xh:tr>
                                <xh:tr>
                                <xh:td>
                                <xf:select1
                                appearance="full"
                                bind="element-1-1-2-bind" id="element-1-1-2-control">
                                <xf:label ref="$form-resources/element-1-1-2/label"/>
                                <xf:hint ref="$form-resources/element-1-1-2/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                <xf:itemset ref="$form-resources/element-1-1-2/item">
                                <xf:label ref="label"/>
                                <xf:value ref="value"/>
                                </xf:itemset>
                                </xf:select1>
                                </xh:td>
                                </xh:tr>
                            </fr:grid>
                        </xf:group>
                        <xh:tr>
                            <xh:td>
                                <xf:input bind="element-1-1-3-bind" id="element-1-1-3-control">
                                <xf:label ref="$form-resources/element-1-1-3/label"/>
                                <xf:hint ref="$form-resources/element-1-1-3/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                </xf:input>
                            </xh:td>
                        </xh:tr>
                        <xh:tr>
                            <xh:td>
                                <xf:select1 appearance="full"
                                bind="element-1-1-4-bind" id="element-1-1-4-control">
                                <xf:label ref="$form-resources/element-1-1-4/label"/>
                                <xf:hint ref="$form-resources/element-1-1-4/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                <xf:itemset ref="$form-resources/element-1-1-4/item">
                                <xf:label ref="label"/>
                                <xf:value ref="value"/>
                                </xf:itemset>
                                </xf:select1>
                            </xh:td>
                        </xh:tr>
                    </fr:grid>
                </xf:group>
                <fr:grid>
                    <xh:tr>
                        <xh:td>
                            <xf:output bind="element-1-1-5-bind" id="element-1-1-5-control">
                                <xf:label ref="$form-resources/element-1-1-5/label"/>
                                <xf:hint ref="$form-resources/element-1-1-5/hint"/>
                                <xf:alert ref="$fr-resources/detail/labels/alert"/>
                            </xf:output>
                        </xh:td>
                    </xh:tr>
                </fr:grid>
            </fr:section>
        </fr:body>
    </fr:view>
</xh:body>
</xh:html>

但只显示嵌套重复"而不是外部"重复.

But only the "nested repeat" is shown and not the "external" one.

问题是:Orbeon 中没有实现吗?它需要特定的语法吗?还是有什么我看不到的错误?

The question is: Is it not implemented in Orbeon? Do It needs an specific syntax? Or is there any error that I cannot see?

我使用的是 Orbeon 4.3.0.1.201308150213-CE.

I am using Orbeon 4.3.0.1.201308150213-CE.

我已经通过一些更正更改了循环的模板"部分.

EDITED: I have changed the loops' "template" section with some corrections.

推荐答案

此时不支持嵌套 .但我们计划很快实施对嵌套部分的支持,这将使您能够做你想做的事.

Nesting <fr:grid> isn't supported at this point. But we're planning to soon implement support for nested sections, which should enable you to do what you're looking for.

这篇关于Orbeon Xforms 嵌套重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆