Rename tag in XML using XSLT -
i have xml below:
<?xml version="1.0" encoding="utf-8" standalone="no"?> <properties> <entry key="user">1234</entry> <entry key="name">sam</entry> </properties>
i want modify key value(key="user" key="id") using xslt, output xml should this
<?xml version="1.0" encoding="utf-8" standalone="no"?> <properties> <entry key="id">1234</entry> <entry key="call">sam</entry> </properties>
could please me this? new xslt area.
for have first transform identity transform handle key:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"></xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="@key[. = 'user']"> <xsl:attribute name="key">id</xsl:attribute> </xsl:template> </xsl:stylesheet>
Comments
Post a Comment