Can XPath concatenate two nodeset values? (for use in XForms)
Posted
by iHeartGreek
on Stack Overflow
See other posts from Stack Overflow
or by iHeartGreek
Published on 2010-06-09T19:21:21Z
Indexed on
2010/06/09
19:32 UTC
Read the original article
Hit count: 229
Hi!
I am wanting to concatenate two nodeset values using XPath in XForms.
I know that XPath has a concat(string, string) function, but how would I go about concatenating two nodeset values?
BEGIN EDIT: I tried concat function.. I tried this.. and variations of it to make it work, but it doesn't
<xf:value ref="concat(instance('param_choices')/choice/root, .)"/>
END EDIT
Below is a simplified code example of what I am trying to achieve.
XForms model:
<xf:instance id="param_choices" xmlns="">
<choices>
<root label="Param Choices">/param</root>
<choice label="Name">/@AAA</choice>
<choice label="Value">/@BBB</choice>
</choices>
</xf:instance>
XForms ui code that I currently have:
<xf:select ref="instance('criteria_data')/criteria/criterion" appearance="full">
<xf:label>Param choices:</xf:label>
<br/>
<xf:itemset nodeset="instance('param_choices')/choice">
<xf:label ref="@label"></xf:label>
<xf:value ref="."></xf:value>
</xf:itemset>
</xf:select>
(if user selects "Name" checkbox..) the XML output is:
<criterion>/@BBB</criterion>
However! I want to combine the root nodeset value with the current choice nodeset value.
Essentially:
<xf:value ref="(instance('definition_choices')/choice/root) + ."/>
to achieve the following XML output:
<criterion>/param/@BBB</criterion>
Any suggestions on how to do this? (I am fairly new to XPath and XForms)
p.s. what I am asking makes sense to me when I typed it out, but if you have trouble figuring out what I'm asking, just let me know..
thanks!
© Stack Overflow or respective owner