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
|
|
The content of the comment may be given
either by a |
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.
In XSLT 3.0, it is often convenient to construct comments using text value templates,
for example <xsl:comment expand-text='yes'>Status: {$status}</xsl:comment>
.
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>