Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Add Comment to generated xml document

File: Data.xml <?xml version="1.0"?> <message>You can insert comments in your output.</message> File: Transform.xslt <xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:output method="xml" indent="yes" />   <xsl:template match="/">     <xsl:comment>comment &amp; msg element</xsl:comment>     <msg>       <xsl:apply-templates />     </msg>   </xsl:template> </xsl:stylesheet> Output: <?xml version="1.0" encoding="UTF-8"?> <!--comment & msg element--><msg>You can insert comments in your output.</msg>