Orbeon Forms: метка Dynami c не работает во вложенной секции - PullRequest
2 голосов
/ 17 июня 2020

Я использую Orbeon Forms 2019.2.0.201912301747 CE.

Моя структура формы выглядит так:

<s-2>
 <s-2-iteration>
  <s-2-position>
   ...
   <s-2.7>
    <s-2.7-iteration>
     <s-2.7-position>
      ...
     </s-2.7-position>
    </s-2.7-iteration>
   </s-2.7>
   ...
  </s-2-position>
 </s-2-iteration>
</s-2>

Теги <...-position> - это разделы, в которых я хотел бы иметь динамику c метки типа «Position no X», где X - номер повтора. Я сделал это для тега <s-2-position>, используя xxf:repeat-position() в разделе Параметры / метка / параметры шаблона ( экран ).

Но когда я попытался сделать это в <s-2.7-position> тег, который вложен в <s-2-position> не сработал. Ярлык был пустым при запуске формы. Более того, когда я пытался использовать какую-либо метку Dynami c в <s-2.7-position> и в любом другом теге внутри <s-2.7-position>, это тоже не сработало.

Итак, вы когда-нибудь сталкивались с этим проблема? Какое решение / обходной путь? Это ошибка Orbeon Froms?

Спасибо!

Ответы [ 3 ]

0 голосов
/ 19 июня 2020

Я нашел причину проблемы. После переименования тега <s-2.7-position> во что-либо кроме s-2.7 (даже разделенных) Dynami c работают метки с параметрами шаблона, в том числе xxf:repeat-position().

0 голосов
/ 22 июня 2020

После изменения имен тегов s-2.7-pozycja в приведенной ниже форме на s-foo метки этих тегов отображаются правильно. Раньше ярлыки вообще не отображались (пусто).

Рабочая форма:

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
         fr:data-format-version="4.0.0">
    <xh:head>
        <xh:title>PL825 - Projekt podziału przemieszczenia</xh:title>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true"
                  xxf:hint.appearance="tooltip">

            <!-- Main instance -->
            <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id">
                <form>
                    <s-2>
                        <s-2-iteration>
                            <s-2-pozycja>
                                <s-2.7>
                                    <s-2.7-iteration>
                                        <s-foo>
                                            <grid-7>
                                                <control-1/>
                                            </grid-7>
                                        </s-foo>
                                    </s-2.7-iteration>
                                </s-2.7>
                            </s-2-pozycja>
                        </s-2-iteration>
                    </s-2>
                </form>
            </xf:instance>

            <!-- Bindings -->
            <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
                <xf:bind id="s-2-bind" ref="s-2" name="s-2">
                    <xf:bind id="s-2-iteration-bind" ref="s-2-iteration" name="s-2-iteration">
                        <xf:bind id="s-2-pozycja-bind" ref="s-2-pozycja" name="s-2-pozycja">
                            <xf:bind id="s-2.7-bind" ref="s-2.7" name="s-2.7">
                                <xf:bind id="s-2.7-iteration-bind" ref="s-2.7-iteration" name="s-2.7-iteration">
                                    <xf:bind id="s-foo-bind" ref="s-foo" name="s-foo">
                                        <xf:bind id="grid-7-bind" ref="grid-7" name="grid-7">
                                            <xf:bind id="control-1-bind" ref="control-1" name="control-1" xxf:whitespace="trim"/>
                                        </xf:bind>
                                    </xf:bind>
                                </xf:bind>
                            </xf:bind>
                        </xf:bind>
                    </xf:bind>
                </xf:bind>
            </xf:bind>

            <!-- Metadata -->
            <xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all">
                <metadata>
                    <application-name>EMSC</application-name>
                    <form-name>PL825</form-name>
                    <title xml:lang="pl">PL825 - Projekt podziału przemieszczenia</title>
                    <description xml:lang="pl"/>
                    <created-with-version>2019.2.0.201912301747 CE</created-with-version>
                    <updated-with-version>2019.2.0.201912301747 CE</updated-with-version>
                    <library-versions>
                        <orbeon>1</orbeon>
                    </library-versions>
                </metadata>
            </xf:instance>

            <!-- Attachments -->
            <xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
                <attachments/>
            </xf:instance>

            <!-- All form resources -->
            <xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
                <resources>
                    <resource xml:lang="pl">
                        <control-1>
                            <label/>
                            <hint/>
                        </control-1>
                        <s-2.7>
                            <label>2.7 </label>
                        </s-2.7>
                        <s-foo>
                            <label>Position {$nr_poz}</label>
                        </s-foo>
                        <s-2>
                            <label>2. </label>
                        </s-2>
                        <s-2-pozycja>
                            <label>Position {$nr_poz}</label>
                        </s-2-pozycja>
                    </resource>
                </resources>
            </xf:instance>
            <xf:instance xxf:readonly="true" xxf:exclude-result-prefixes="#all" id="s-2-template">
                <s-2-iteration>
                    <s-2-pozycja>
                        <s-2.7>
                            <s-2.7-iteration>
                                <s-foo>
                                    <grid-7>
                                        <control-1/>
                                    </grid-7>
                                </s-foo>
                            </s-2.7-iteration>
                        </s-2.7>
                    </s-2-pozycja>
                </s-2-iteration>
            </xf:instance>
            <xf:instance xxf:readonly="true" xxf:exclude-result-prefixes="#all" id="s-2.7-template">
                <s-2.7-iteration>
                    <s-foo>
                        <grid-7>
                            <control-1/>
                        </grid-7>
                    </s-foo>
                </s-2.7-iteration>
            </xf:instance>
        </xf:model>
    </xh:head>
    <xh:body>
        <fr:view>
            <fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl"
                     xmlns:oxf="http://www.orbeon.com/oxf/processors">
                <fr:section id="s-2-section" bind="s-2-bind" repeat="content" min="2"
                            template="instance('s-2-template')"
                            apply-defaults="true"
                            fb:initial-iterations="first">
                    <xf:label ref="$form-resources/s-2/label"/>
                    <fr:section id="s-2-pozycja-section" bind="s-2-pozycja-bind">
                        <xf:label ref="$form-resources/s-2-pozycja/label">
                            <fr:param type="ExpressionParam">
                                <fr:name>nr_poz</fr:name>
                                <fr:expr>xxf:repeat-position()</fr:expr>
                            </fr:param>
                        </xf:label>
                        <fr:section id="s-2.7-section" bind="s-2.7-bind" repeat="content" max="99"
                                    template="instance('s-2.7-template')"
                                    apply-defaults="true"
                                    fb:initial-iterations="first">
                            <xf:label ref="$form-resources/s-2.7/label"/>
                            <fr:section id="s-foo-section" bind="s-foo-bind">
                                <xf:label ref="$form-resources/s-foo/label">
                                    <fr:param type="ExpressionParam">
                                        <fr:name>nr_poz</fr:name>
                                        <fr:expr>xxf:repeat-position()</fr:expr>
                                    </fr:param>
                                </xf:label>
                                <fr:grid id="grid-7-grid" bind="grid-7-bind">
                                    <fr:c x="1" y="1" w="12">
                                        <xf:input id="control-1-control" bind="control-1-bind">
                                            <xf:label ref="$form-resources/control-1/label"/>
                                            <xf:hint ref="$form-resources/control-1/hint"/>
                                            <xf:alert ref="$fr-resources/detail/labels/alert"/>
                                        </xf:input>
                                    </fr:c>
                                </fr:grid>
                            </fr:section>
                        </fr:section>
                    </fr:section>
                </fr:section>
            </fr:body>
        </fr:view>
    </xh:body>
</xh:html>`

Неправильное поведение

Wrong behavior

Expected behavior

Ожидаемое поведение

0 голосов
/ 18 июня 2020

В самом деле, было бы разумно, если бы xxf:repeat-position() работал в этом случае, или имел бы более высокий уровень функций Form Runner, специфичных для c. Это покрывается запросом на улучшение (RFE) # 4144 . А пока вы можете попробовать, как упоминается в RFE, что-то вроде:

count(../preceding-sibling::*) + 1
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...