xsl-list
[Top] [All Lists]

Re: [xsl] using xsl:output-character to render characters in 2 ways

2009-12-22 12:20:34
One of the reasons I am using a character map in this example is to
create a CDATA section in the output:

<script type="text/javascript">//<![CDATA[
some.onload(function(){
});
//]]></script>

As I need '//' to appear before the CDATA section I cannot use the
cdata-section-elements <xsl:output/> attribute.

(Here's an example of why I need the '//':
http://javascript.about.com/library/blxhtml.htm )

Is there a way I can produce this kind of CDATA section in the output
without resorting to character maps?

Though I loath to recommend it, you could use disable-output-escaping= as
follows:

<script type="text/javascript">//<xsl:text
disable-output-escaping="yes">&lt;</xsl:text>![CDATA[
some.onload(function(){
}};
//<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text></script>

Or if you use the "html" output method, then

<script type="text/javascript">//&lt;![CDATA[
some.onload(function(){
});
//]]&gt;</script>

should serialise as

<script type="text/javascript">//<![CDATA[
  some.onload(function(){
  });
  //]]>
</script>

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--