Reputation: 1752
Using XSL to create a HTML page from a XML I would like to know how to write a comment in the resultant HTML page.
This is my XSL so far:
<?xml version="1.0" encoding="US-ASCII" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" omit-xml-declaration="no" indent="yes" />
<xsl:text disable-output-escaping="yes">
<![CDATA[<!--comment-->]]>
</xsl:text>
</xsl:stylesheet>
It doesnt work, and it gives the next error:
Warning: XSLTProcessor::importStylesheet(): compilation error: file mydirectoy/Myxsl.xsl line 4 element text
How can I make this work?
Upvotes: 0
Views: 483
Reputation: 6115
do it like this:
...
<xsl:comment>comment</xsl:comment>
...
You won't wrap it into xsl:text
or CDATA
. xsl:comment
will create a comment node in the result tree. Here's the link to the spec: http://www.w3.org/TR/xslt#section-Creating-Comments
Upvotes: 2