Partager via


xsl:comment Element (Windows Embedded CE 6.0)

1/6/2010

Generates a comment in the output.

Syntax

<xsl:comment>
</xsl:comment>

Attributes

None.

Element Information

Number of occurrences

Unlimited

Parent elements

xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements

Child elements

xsl:apply-templates, xsl:call-template, xsl:choose, xsl:copy, xsl:copy-of, xsl:for-each, xsl:if, xsl:text, xsl:value-of, xsl:variable

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.

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