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 &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.

-----------------------------------------------------------------------

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 &lt; 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 &lt; b) foo()
    </script>


BTW: with CDATA it works ... but there's another strage one:

if I replace the

   <script>if (a &lt; 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


Reply via email to