0

次のインスタンスがあります。

<xforms:instance id="fr-form-instance">
    <form>
        <section-1>
            <control-1>
                <en>Nothing special.</en>
                <ro>Nimic special.</ro>
            </control-1>
        </section-1>
    </form>
</xforms:instance>

次のように、選択した言語で値を読み取って編集する入力を追加したいと思います。

...
<xhtml:td>
    <xforms:output value="instance('fr-form-instance')/section-1/control-1/*[name()=xxforms:lang()]"/>
    <xforms:input id="control-1-control" ref="instance('fr-form-instance')/section-1/control-1/*[name()=xxforms:lang()]"/>
</xhtml:td>
...

問題は、出力テキストが正しく表示されることです。言語を変更すると、テキストも変更されますが、入力フィールドは表示されません。[name()='ro']の代わりに使用するように xpath を変更すると[name()=xxforms:lang]、機能します。どうすれば動的に動作させることができますか?

4

1 に答える 1

0

これは私のために働いているようです。私は得る:

ここに画像の説明を入力

言語ピッカーから「română」を選択すると、次のようになります。

ここに画像の説明を入力

これを再現したい場合に備えて、フォームの完全なソースの下に貼り付けました。これを Orbeon Forms 4.0 でテストしました。

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:exf="http://www.exforms.org/exf/1-0"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:saxon="http://saxon.sf.net/"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
    <xh:head>
        <xh:title/>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">

            <!-- Main instance -->
            <xf:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-1>
                            <en>Nothing special.</en>
                            <ro>Nimic special.</ro>
                        </control-1>
                    </section-1>
                </form>
            </xf:instance>

            <!-- Bindings -->
            <xf:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
                     ref="instance('fr-form-instance')">
                <xf:bind id="section-1-bind" name="section-1" ref="section-1">

                </xf:bind>
            </xf:bind>

            <!-- Metadata -->
            <xf:instance xxf:readonly="true" id="fr-form-metadata">
                <metadata>
                    <application-name>a</application-name>
                    <form-name>a</form-name>
                    <title xml:lang="en"/>
                    <description xml:lang="en"/>
                    <title xml:lang="ro"/>
                    <description xml:lang="ro"/>


                </metadata>
            </xf:instance>

            <!-- Attachments -->
            <xf:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xf:instance>

            <!-- All form resources -->
            <!-- Don't make readonly by default in case a service modifies the resources -->
            <xf:instance id="fr-form-resources" xxf:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <section-1>
                            <label/>
                            <help/>
                        </section-1>

                    </resource>
                    <resource xml:lang="ro">
                        <section-1>
                            <label/>
                            <help/>
                        </section-1>

                    </resource>

                </resources>
            </xf:instance>

            <!-- Utility instances for services -->
            <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
                <request/>
            </xf:instance>

            <xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
                <response/>
            </xf:instance>

        </xf:model>
    </xh:head>
    <xh:body>
        <fr:view>
            <fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
                     xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
                     xmlns:oxf="http://www.orbeon.com/oxf/processors"
                     xmlns:p="http://www.orbeon.com/oxf/pipeline">
                <fr:section id="section-1-control" bind="section-1-bind">
                    <xf:label ref="$form-resources/section-1/label"/>
                    <xf:help ref="$form-resources/section-1/help"/>
                    <fr:grid>
                        <xh:tr>
                            <xh:td>
                                <xf:output value="instance('fr-form-instance')/section-1/control-1/*[name()=xxforms:lang()]"/>
                                <xf:input id="control-1-control"
                                          ref="instance('fr-form-instance')/section-1/control-1/*[name()=xxforms:lang()]"/>
                            </xh:td>
                            <xh:td/>
                        </xh:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xh:body>
</xh:html>
于 2013-02-27T01:14:45.470 に答える