Reputation: 4970
I need to transform the following XML:
<Summary>
<assets>54</assets>
<projects>471</projects>
</Summary>
into:
<Summary>
<item name="assets" value="54"></item>
<item name="projects" value="471"></item>
</Summary>
Can anybody, please help?
Thanks
Upvotes: 1
Views: 61
Reputation: 243599
As easy as this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*/*">
<item name="{name()}" value="{.}"/>
</xsl:template>
</xsl:stylesheet>
Upvotes: 1