xslt - what is the XSL to convert the following xml to another xml -
i have xml file of below format:
-<table> <a> <a>x</a> <b>y</b> </a> <b> ... ... .... </b> <c> ... ... ... </c> </table>
i want make "a" root node instead of table. there way code in xsl above xml looks below?
<a a="x" b="y"> <b> ... ... ... </b> <c> ... ... ... </c> </a>
try
<xsl:template match="table"> <a> <xsl:for-each select="a/*"> <xsl:attribute name="{local-name()}"> <xsl:value-of select="."/> </xsl:attribute> </xsl:for-each> <xsl:copy-of select="*[not(self::a)]"/> </a> </xsl:template>
Comments
Post a Comment