I've been trying to concatenate two XML elements into one.
Input File
<Location>
<Location_Name>Test Location</Location_Name>
<Address>
<Country>USA</Country>
<Address_Line_Data>2 Sample St</Address_Line_Data>
<Address_Line_Data>35 Wentworth Ave</Address_Line_Data>
<Municipality>Meier</Municipality>
</Address>
</Location>
Desired Output file
<Location>
<Location_Name>Test Location</Location_Name>
<Address>
<Country>USA</Country>
<Address_Line_Data>2 Sample St - 35 Wentworth Ave</locc:Address_Line_Data>
<Municipality>Meier</Municipality>
</Address>
</Location>
How can I achieve that using XSLT ?
I've tried the following but no success.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs" version="2.0">
<xsl:output method="xml" indent="yes"/>
<!-- Identity template -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Location/Address/Address_line_Data"">
<xsl:for-each select=".">
<xsl:value-of select="concat(.,' - ')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<Address_Line_Data>2 Sample St</locc:Address_Line_Data>is not even well-formed, neither in the input nor in the output.