1

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

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:exforms="http://www.exforms.org/exf/1-0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xhtml:head>
    <xforms:instance id="instanceData">
        <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <fruits>
                <fruit>
                    <fruit-name>Mango</fruit-name>
                </fruit>
                <fruit>
                    <fruit-name>Apple</fruit-name>
                </fruit>
                <fruit>
                    <fruit-name>Banana</fruit-name>
                </fruit>
            </fruits>
            <all-fruits></all-fruits>
        </form>
    </xforms:instance>
</xhtml:head>
</xhtml:html>

以下のように、 all-fruitsタグにすべての果物の名前を入れたい

<all-fruits>Mango Apple Banana</all-fruits>

同じことを達成するためのいくつかの方法を提案してください。xxforms:iterateとconcatで試したところ、うまくいきませんでした。

4

1 に答える 1

2

以下はトリックを行います:

<xforms:bind nodeset="all-fruits"
             calculate="string-join(../fruits/fruit/fruit-name, ' ')"/>

そして、ここに完全なソースがあるので、実行できます:

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:exforms="http://www.exforms.org/exf/1-0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xforms="http://www.w3.org/2002/xforms">
    <xhtml:head>
        <xforms:model>
            <xforms:instance id="instanceData">
                <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    <fruits>
                        <fruit>
                            <fruit-name>Mango</fruit-name>
                        </fruit>
                        <fruit>
                            <fruit-name>Apple</fruit-name>
                        </fruit>
                        <fruit>
                            <fruit-name>Banana</fruit-name>
                        </fruit>
                    </fruits>
                    <all-fruits></all-fruits>
                </form>
            </xforms:instance>
            <xforms:bind nodeset="all-fruits" calculate="string-join(../fruits/fruit/fruit-name, ' ')"/>
        </xforms:model>
    </xhtml:head>
    <xhtml:body/>
</xhtml:html>
于 2011-03-22T22:36:35.390 に答える