[Solved] XLST – Copy XML tag and replace attribute value [closed]
XSLT based solution. Input XML <config> <connection port=”4404″ type=”tcp”> <selection name=”test-mode” enabled=”true”/> </connection> <connection port=”4405″ type=”tcp”> <selection name=”test-mode” enabled=”true”/> </connection> <connection port=”4406″ type=”tcp”> <selection name=”test-mode” enabled=”true”/> </connection> <option> <maxNumberOfDownloads>10</maxNumberOfDownloads> </option> </config> XSLT <?xml version=”1.0″?> <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output method=”xml” encoding=”utf-8″ indent=”yes” omit-xml-declaration=”yes”/> <xsl:strip-space elements=”*”/> <xsl:template match=”@*|node()”> <xsl:copy> <xsl:apply-templates select=”@*|node()”/> </xsl:copy> </xsl:template> <xsl:template match=”connection[@port]”> <xsl:copy> <xsl:apply-templates … Read more