xsl-list
[Top] [All Lists]

[xsl] XSLT containing javascript code with '<'

2012-02-11 13:59:03
This is the essential part of what I have (after some research):

<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    xmlns="http://www.w3.org/1999/xhtml";>

<xsl:output method = "html" cdata-section-elements="script" encoding =
"UTF-8" indent = "yes"/>

<xsl:template match="/">
<html>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <head>
    <script type="text/javascript"><![CDATA[
function restore(){
   if( 1 < 10 )  alert("x");  // something else in reality.
}
]]></script>
    <title>X</title>
  </head>
  <body>
  </body>
</html>
</xsl:template>
</xsl:stylesheet>

However, the output from Saxon 9 (latest) contains
    if( 1 &lt; 10 )  alert("x");
which Chrome refuses to accept as correct javascript, and I think it is right.

Omitting cdata-section-elements="script" doesn't alter anything, of course.

Any ideas?
Wolfgang

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>