This seems like an easy one, but one that I haven't come across before.
I need to retain the comments in an XML file to the output XML after applying an XSLT.
Does anyone know how/if this is possible? Thanks!
This seems like an easy one, but one that I haven't come across before.
I need to retain the comments in an XML file to the output XML after applying an XSLT.
Does anyone know how/if this is possible? Thanks!
In your XSL you can reference comments in your source XML similar to other elements, e.g.:
<xsl:template match="comment()">
<xsl:value-of select="."/>
</xsl:template>
If it should appear in your transformed XML as comment as well you can do the following:
<xsl:template match="comment()">
<xsl:comment>
<xsl:value-of select="."/>
</xsl:comment>
</xsl:template>