Re: [xsl] Preventing CDATA output in XHTML

Subject: Re: [xsl] Preventing CDATA output in XHTML
From: Dale Tan <wtdtan@xxxxxxxxx>
Date: Tue, 03 Jul 2007 01:28:48 -0400
hey brian,
have you checked your <xsl:output method>?
i'm assuming you are using xslt 1.0 (or 1.1, whatever it is, just not 2) so there is no native "xhtml".


so you can do something like the following:

<xsl:output
   method="xml"
   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
   omit-xml-declaration="yes"
   encoding="UTF-8"
   indent="yes" />

the key there is the "method" attribute. in order to get a true "xhtml" doc type, that needs to be equal to "xml" otherwise you will be parsing as regular "html" where your self-closing tags will not be closed (<img> instead of <img />, <br> instead of <br />, etc)

this way, you can go back and do this with your javascript:

<script type="text/javascript">
   <xsl:comment>
      ...
      javascript  in here
      ...
   //</xsl:comment>
</script>

hope that helps. good luck.

dale

Current Thread