Hello Brent,

it works for me by default.

<script type="text/javascript">
  function test() {
    if (1 &lt; 2) {}
  }
</script>

in the stylesheet is converted to (1 < 2) in the HTML output when using the HTML serializer. This is with Cocoon 2.1 and Xalan 2.5.1. I have neither configured something special in xsl:output nor the serializer declaration.

Joerg

On 23.10.2003 16:43, Brent L Johnson wrote:

That does make since that it wouldnt escape the
chars between script tags.  So I checked my sitemap file
and I was indeed serializing to xhtml - so I changed it
to html and I'm still having the same problem.

    <map:match pattern="index.html">
        <map:generate src="welcome.xml"/>
        <map:transform src="resources/styles/xsl/welcome.xsl"
type="xslt"/>
        <map:serialize type="html"/>
    </map:match>

Pretty straightforward.  I'll dig through the docs related
to the serializer and see what I find.

Here's a portion of the XSL file:

<xsl:template match="welcome">
...
      <script language="Javascript">
      <![CDATA[
          function checkAgree() {
              if (2 > 1) {
                  alert('DOH!');
              }
          }
      ]]>
      </script>
...

Thanks,

- Brent


Probably you want to look at some details on HTML vs. XML output methods of xslt - http://www.w3.org/TR/xslt#section-HTML-Output-Method . Relevant info there looks something like this: ________________________________________________
The html output method should not perform escaping for the content of the script and style elements. For example, a literal result element written in the stylesheet as


<script>if (a &lt; b) foo()</script>
or

<script><![CDATA[if (a < b) foo()]]></script>
should be output as

<script>if (a < b) foo()</script>
The html output method should not escape < characters occurring in attribute values. ________________________________________________


So, simple solution would be changing map:serialize from xml or xhtml to html. If it doesn't work for you, then probably you could try some analogy of <xsl:output cdata-section-elements="script"/> by modifying settings for your map:serialize / map:serializer - I can't give you details for that, try to find it in docs for XMLSerializer.



I'll say sorry up front - I'm sure this is a newbie thats been answered a hundred times on this list. The search terms

are so vague


that I don't get any good results from searching around on the internet.

Pretty simple - I've got Javascript in my XSL file that
needs a less-than symbol. I've got the Javascript wrapped

in a CDATA


section.. but thats getting converted to &lt; in the code.

How can I prevent this?

Probably somebody from advanced cocooners can provide better details / comment / solution for this problem - I also would be very interested in that.



Thanks,

- Brent

Thanks, Ru


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to