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

Home
XML
1.CSS Style
2.SVG
3.XML Schema
4.XQuery
5.XSLT stylesheet
XML » XSLT stylesheet » comment 
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.