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.
<!-- 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With