Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Generates a comment in the output.

Syntax

<xsl:comment>
</xsl:comment>

Attributes

None.

Element Information

Remarks

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

Example

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

Copy Code
news.xml
<?xml version ="1.0"?>
<?xml-stylesheet type="text/xsl" href="comment1.xsl"?>
<news>
   <story1>Here is the top news story.</story1>
   <story2>News is the next news story.</story2>
</news>
news.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<HTML>
<BODY>
<xsl:comment>insert top news story</xsl:comment>
<P>
<xsl:value-of select="//story1"/>
</P>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
XSLT Output
<HTML>
<BODY>
<!--insert top news story-->
<P>Here is the top news story.</P>
</BODY>
</HTML>

See Also

Reference

XSLT Elements