You have to use <xsl:text disable-output-escaping="yes">if (a < b)
foo()<xsl:text> for you JavaScript fragments.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Sablotron Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 4:46 AM
Subject: [Sab] wrong output of html-encoding method?
> Hi all,
>
> -----------------------------------------------------------------------
>
> http://www.w3.org/TR/1999/REC-xslt-19991116#section-HTML-Output-Method
>
> 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 < 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.
>
> -----------------------------------------------------------------------
>
> I'm using sab 0.60 with PHP4.05 on Linux, if my xslt looks like this
>
>
> <xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
> <xsl:output method="html" encoding="iso-8859-1" indent="yes"/>
> <xsl:template name="headerAdminTmpl">
> <script>if (a < b) foo()</script>
> </xsl:template>
> </xsl:stylesheet>
>
>
> note: the above code is imported by another template.
>
>
> the result looks - in opposite to W3Cs recommendation - like this:
>
> <script>if (a < b) foo()
> </script>
>
>
> BTW: with CDATA it works ... but there's another strage one:
>
> if I replace the
>
> <script>if (a < b) foo()</script>
>
> by
>
> <script language="JavaScript" type="text/javascript"
src="../test.js"></script>
>
> the result is:
>
> <script language="JavaScript" type="text/javascript" src="../test.js">
>
> => the </script> is missing!
> I found a small workaround using <xsl:comment>:
>
> <script language="JavaScript" type="text/javascript"
> src="../test.js"><xsl:comment></xsl:comment></script>
>
> which results in:
>
> <script language="JavaScript" type="text/javascript"
src="../test.js">
> <!---->
> </script>
>
>
>
> So, am I doing wrong or are these bugs of sablotron?
>
> Lars
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com