I have a some xml fields i need to concatenate all the fields in one field
<fields>
<field name="first"><value>example</value></field>
<field name="last"><value>hello</value></field>
<field name="age"><value>25</value></field>
<field name="enable"><value>1</value></field>
<fields>
i need to transform as following
<fields>
<field name="all"><value>example hello 25 1</value></field>
</field>
with space delimiter using XSL
This short and simple (no explicit conditional instructions) XSLT 1.0 transformation:
when applied on the provided XML document (corrected for well-formedness):
produces the wanted, correct result:
II. XSLT 2.0 solution
When this transformation is applied on the same XML document (above), the same correct result is produced:
Explanation: Using the fact that the default value for the
separatorattribute ofxsl:value-ofis a single space.