I have XML that I need to convert to a more simplified format. I am sure this can be done with XSLT, but I am unsure how.
I need to convert:
<Fields>
<Field>
<Name>Element1</Name>
<Value>Value 1</Value>
</Field>
<Field>
<Name>Element2</Name>
<Value>Value 2</Value>
</Field>
</Fields>
into
<Fields>
<Element1>Value 1</Element1>
<Element2>Value 2</Element2>
</Fields>
This is what I have currently:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select="Fields/Field/*"/>
<xsl:apply-templates select="*[name()]"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>