I have the following data instance.
<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>
i would like to have all the fruit names i开发者_高级运维n all-fruits tag as below
<all-fruits>Mango Apple Banana</all-fruits>
Please suggest some way to achieve the same. It didn't work for me when tried with xxforms:iterate and concat.
The following does the trick:
<xforms:bind nodeset="all-fruits"
calculate="string-join(../fruits/fruit/fruit-name, ' ')"/>
And here is the full source so you can run it:
<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>
精彩评论