SAXONICA |
The xsl:comment
element can appear anywhere within an xsl:template
. It indicates
text that is to be output to the current output stream in the form of an XML or HTML
comment.
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.
For example, 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>
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.
Tip: the xsl:comment
element can be very useful for debugging your stylesheet. Use comments in the generated
output as a way of tracking which rules in the stylesheet were invoked to produce the output.