<xsl:comment> …… </xsl:comment>
The xsl:comment element is used to generate a comment in the output.
The purpose of a comment is simply to provide information that may be of interest or importance to human users of the code.
For example, you could list information about the program itself, such as the date of creation and programmer names or catalog changes and corrections. Carefully placed comments can also be used to debug code.
In one regard, the ability to comment in XSL is far more sophisticated than the ability to comment in other languages such as HTML and VBScript.
Like other elements in XSL, the xsl:comment element can make use of extension functions and can contain functions. While this may be of limited use for a comment, you can do things like include date-time stamps in your comment as demonstrated in this code fragment:
<xsl:comment> <xsl:value-of select=”Date:toString()” /> </xsl:comment>
This element has no attributes. It is not a self-closing tag. The separate closing element is mandatory.
We use the eBIZ.com Staff List XML file for our example with the following header:

<?xml-stylesheet type=”text/xsl” href=”xslt_example_comment.xsl”?> 

and we name it: xslt_example_comment.xml

Scroll to Top