The xsl:comment Element

Amidst all the syntactic clutter of XML, XSL, and HTML files, it's easy to lose track of the fact that an XSL file generates an HTML file. The xsl:comment element is used to insert an HTML style comment into the HTML file that's created by the execution of the XSL file. Before you look at the XSL operators, this hour will illustrate how the xsl:comment element will insert a comment into the HTML code generated by the XSL template. As a data source, use Listing 15.3.

Reopen listing15-8.xsl and insert the following boldfaced lines into the code:

<html>
<xsl:comment>
						This comment was inserted using the xsl:comment element
						</xsl:comment>
<body>

Reopen listing14-2.html and modify it to match Listing 16.1.

Listing 16.1 Examining ...

Get Sams Teach Yourself XML in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.