cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent L Johnson" <br...@bjohnson.net>
Subject RE: Special Chars in HTML Output
Date Thu, 23 Oct 2003 14:43:53 GMT
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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message