I was wondering how to use a dynamic elements in Orbeon. In the sandbox of Orbeon exists an example called dynamic-dropdown (http://localhost:8080/orbeon/xforms-sandbox/sample/dynamic-dropdown
).
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
<head>
<title>Dynamic dropdown depending on checkboxes</title>
<xf:model>
<xf:instance id="selected-values" xmlns="">
<instance>
<pets/>
<favorite/>
</instance>
</xf:instance>
<xf:instance id="pets" xmlns="">
<root>
<item name="Cat" value="cat"/>
<item name="Dog" value="dog"/>
<item name="Fish" value="fish"/>
<item name="Cobra" value="cobra"/>
</root>
</xf:instance>
</xf:model>
<style type="text/css">
.xforms-label { display: block; font-weight: bold }
</style>
</head>
<body>
<xf:select ref="pets" appearance="full">
<xf:label>Please list all your pets:</xf:label>
<xf:itemset ref="instance('pets')/item">
<xf:label ref="@name"/>
<xf:value ref="@value"/>
</xf:itemset>
</xf:select>
<br/>
<xf:select1 ref="favorite">
<xf:label>Select your favorite pet:</xf:label>
<xf:itemset>
<xf:label/>
<xf:value/>
</xf:itemset>
<xf:itemset ref="instance('pets')/item[@value = xxf:split(context()/../pets)]">
<xf:label ref="@name"/>
<xf:value ref="@value"/>
</xf:itemset>
</xf:select1>
</body>
</html>
I have tested in Orbeon 4.8 and 4.9 and does nothing. By nothing, I refer that the dropdown list does not fill up with the selected elements.
I can test it also in an "open" sandbox (http://www.argonauta.org/orbeon/xforms-sandbox/sample/dynamic-dropdown) and here is working fine. But I have no idea which version is (maybe 4.3).
The question: is the example not valid in the current version of Orbeon? is it a bug? If the example is not valid, what modification must be done?
Ok, Seems that if you change line:
<xf:itemset ref="instance('pets')/item[@value = xxf:split(context()/../pets)]">
To
<xf:itemset ref="instance('pets')/item[@value = xxf:split(context()/pets)]">
The example works in version 4.9 of Orbeon.