<xsl:comment> Element

Generates a comment in the output.


The text generated by the children of <xsl:comment> appears between the starting characters (<!--) and the closing characters (-->).

In the following example, the news.xsl style sheet transforms the news.xml document, and inserts a comment into the XSLT output.

XML File (news.xml)

<?xml version ="1.0"?>
<?xml-stylesheet type="text/xsl" href="news.xsl"?>
<story1>Here is the top news story.</story1>
    <story2> Here is the next news story.</story2>

XSLT File (news.xsl)

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="/">
<xsl:comment>insert top news story</xsl:comment>
<xsl:value-of select="//story1"/>



This is the formatted output:

Here is the top news story.

This is the processor output:

<BODY><!--insert top news story-->
<P>Here is the top news story.</P>

Build Date: