xsl:comment

Indicates text that is to be output to the current output stream in the form of an XML or HTML comment.

Category: instruction
Content: sequence-constructor
Permitted parent elements: any XSLT element whose content model is sequence constructor; any literal result element

Attributes

select?

expression

The content of the comment may be given either by a select attribute or by an enclosed sequence constructor. If the select attribute is used and the value is a sequence, then the items in the sequence are output space-separated.

Details

The xsl:comment element can appear anywhere within an xsl:template.

Note that special characters occurring within the comment text will not be escaped.

The xsl:comment element will normally contain text only but it may contain other elements such as xsl:if or xsl:value-of. However, it should not contain literal result elements.

Examples

The text below inserts some JavaScript into a generated HTML document:

<script language="JavaScript"> <xsl:comment> function bk(n) { parent.frames['content'].location="chap" + n + ".1.html"; } //</xsl:comment> </script>

Links to W3C specifications

XSLT 2.0 Specification

XSLT 3.0 Specification