<?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html> <head> <this-is section="xsl-elements" page="comment" subpage=""/> <!-- Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: xsl:comment</title> <meta name="coverage" content="Worldwide"/> <meta name="copyright" content="Copyright Saxonica Ltd"/> <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:comment"/> <meta name="robots" content="noindex,nofollow"/> <link rel="stylesheet" href="../saxondocs.css" type="text/css"/> </head> <body class="main"> <h1>xsl:comment</h1> <p>The <code>xsl:comment</code> element can appear anywhere within an <code>xsl:template</code>. It indicates text that is to be output to the current output stream in the form of an XML or HTML comment.</p> <p>The content of the comment may be given either by a <code>select</code> attribute or by an enclosed sequence constructor. If the <code>select</code> attribute is used and the value is a sequence, then the items in the sequence are output space-separated.</p> <p>For example, the text below inserts some JavaScript into a generated HTML document:</p> <div class="codeblock" style="border: solid thin; background-color: #B1CCC7; padding: 2px"> <pre> <code><script language="JavaScript"> <xsl:comment> function bk(n) { parent.frames['content'].location="chap" + n + ".1.html"; } //</xsl:comment> </script> </code> </pre> </div> <p>Note that special characters occurring within the comment text will <i>not</i> be escaped.</p> <p>The <code>xsl:comment</code> element will normally contain text only but it may contain other elements such as <a class="bodylink" href="../xsl-elements/if.xml">xsl:if</a> or <a class="bodylink" href="../xsl-elements/value-of.xml">xsl:value-of</a>. However, it should not contain literal result elements. </p> <div class="boxed" style="border: solid thin; background-color: #B1CCC7; padding: 2px">Tip: the <code>xsl:comment</code> 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.</div> <table width="100%"> <tr> <td> <p align="right"><a class="nav" href="copy.xml">Next</a></p> </td> </tr> </table> </body> </html>