RE: [xsl] limitations of xsl:comment

Subject: RE: [xsl] limitations of xsl:comment
From: "Stuart Celarier" <stuart@xxxxxxxxxxx>
Date: Sun, 12 May 2002 19:15:39 -0700
A comment in XML consists of character data, see the XML specification,
for details. Comments have no children, they are straight text.

When you place what _looks_ like XML markup in you comment, it is still
just text, so the comment <!-- <Tag> </Tag> --> does not include a Tag
element as a child, just a bunch of characters happen to resemble
markup. Check out the sample comment in the XML specification (link
above) and notice that its contents are not well-formed XML.

I am not sure I understand what your second question is getting at
regarding comments and CDATA sections. This may help. Comments are not
part of the data expressed by an XML document. In fact XML parsers are
free to drop comments when constructing a DOM from an XML document.
OTOH, a CDATA section indicates that the enclosed characters are to be
interpreted literally, and not to be construed as markup. In the case of
both a comment and a CDATA section, the contents are not taken as part
of the markup. However, the contents of a CDATA section are part of the
text data of the document, while the contents of a comment are not part
of the data of the document.


 XSL-List info and archive:

Current Thread