Copy comment with comment() function : comment « XSLT stylesheet « XML






Copy comment with comment() function


File: Data.xml

<documentation>The following is a revision.</documentation>


File: Transform.xslt

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:output method="xml" omit-xml-declaration="yes" indent="no" />

  <xsl:template match="comment()">
    <xsl:comment>
      <xsl:value-of select="." />
    </xsl:comment>
  </xsl:template>

  
</xsl:stylesheet>

Output:

The following is a revision.

 








Related examples in the same category

1.Add comments to generated xml
2.Hyphens in xsl:comment element make it illegal
3.Create comment in style sheet
4.match comment