uncomment XML content with XSLT
xslt
Solution
<!-- the identity template copies everything
(unless more specific templates apply) -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<!-- this template matches comments and uncomments them -->
<xsl:template match="comment()">
<xsl:value-of select="." disable-output-escaping="yes" />
</xsl:template>
Be aware that `disable-output-escaping="yes"` implies that the comment contents should be well-formed.
Problem
I have a problem with XML and XSLT. I have one XML file with some comment and I want to uncomment it. For example: ``` <my-app> <name> </name> <!-- <class> <line></line> </class>--> </my-app> ``` I want to uncomment this commented tag.