Given the below XML, how can I get both values with a single statement?
I tried /root/set/name/. with no luck.
<root>
<set>
<name>John</name>
</set>
<set>
<name>Jane</name>
</set>
</root>
If you want to get the output as John Jane use this XSLT.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:template match="root">
<xsl:value-of select="normalize-space()" />
</xsl:template>
</xsl:stylesheet>
this applied on,
<root>
<set>
<name>John</name>
</set>
<set>
<name>Jane</name>
</set>
</root>
will give John Jane
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With