Search code examples
orbeonxforms

Links in an XForms expression


If i have foreign web page addresses like

http://example.com/ex1
http://example.com/ex2
http://example.com/ex3
http://example.com/ex4

and instance

<xforms:instance id="temp">
    <temp>
        <links>
            <item>ex1</item>
            <item>ex2</item>
            <item>ex3</item>
            <item>ex4</item>
        </links>
    </temp>
</xforms:instance>

And a cycle

<xforms:group ref="instance('temp')/links">
    <xforms:output value="[concat('<a href="http://example.com/',string(item)),'">',string(item),'</a>']">
        <xforms:label>Roll</xforms:label>
    </xforms:output>
</xforms:group>

How to put the link in such expression in value attribute in an orbeon xform? Thank you.


Solution

  • You don't say what you want to achieve, but I assume it's to output a series of <a href="...">. If so, the following works:

    <xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
             xmlns:xf="http://www.w3.org/2002/xforms">
        <xh:head>
            <xf:model>
                <xf:instance id="temp">
                    <temp>
                        <links>
                            <item>ex1</item>
                            <item>ex2</item>
                            <item>ex3</item>
                            <item>ex4</item>
                        </links>
                    </temp>
                </xf:instance>
            </xf:model>
        </xh:head>
        <xh:body>
            <xf:repeat ref="instance('temp')/links/item">
                <xh:a href="http://example.com/{.}">Roll</xh:a>
            </xf:repeat>
        </xh:body>
    </xh:html>