Please find below my xform page.
<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>
</form>
</xforms:instance>
</xhtml:head>
</xhtml:html>
I would like to insert a attribute taste="good" to all fruit-name tags as below
<fruit-name taste="good">
I tried the following ways to achieve the same but it always inserts the attribute to first fruit-name only.
<xforms:insert ev:event="xforms-model-construct-done"
context="instance('instanceData')/fruits/fruit/fruit-name"
origin="xxforms:attribute('taste','good')" />
<xforms:insert ev:event="xforms-model-construct-done"
context="instance('instanceData')/fruits/fruit[position() > 0]/fruit-name"
origin="xxforms:attribute('taste','good')" />
Please suggest a way to insert this attribute to all fruit-name nodes at shot. Since the fruits list dynamic, we need to have a dynamic solution for it.