Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project


   







ELEMENT:  xsl:comment

<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 DevGuru 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
 
In this example, we place a comment stating when and who wrote the code, and we list the names of the DevGuru staff members.
 
Code for xslt_example_comment.xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<xsl:comment>Written on 4/24/2001 by the Guru</xsl:comment>
<xsl:for-each select="devguru_staff/programmer">
NAME: <xsl:value-of select="name" />
<br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</stylesheet>

 
Output:
Click to view output in separate window - requires Internet Explorer

 
 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information