Subject: Re: HTML <script> tag
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 29 Aug 2002 10:11:57 +0100
|
Hi Stuart,
> I am including the following line in an XSLT template:
>
> <script type="text/javascript" language="JavaScript" src="viewSource.js">
> </script>
>
> I use the latest Xalan for Java and the problem is that since the
> text node of the element is empty, the XSLT engine generates the
> following:
>
> <script type="text/javascript" language="JavaScript" src="viewSource.js" />
>
> Well that is fine but for some bizarre reason neither the latest
> version of IE nor Mozilla recognize this HTML and, worse, it causes
> the whole page to render blank!
For what it's worth, when I have the same problem when creating
*XHTML* (when I don't want to use the 'html' output method), I create
a comment inside the script element so that it has some content, and
this seems to work. In the XSLT:
<script type="text/javascript" language="JavaScript"
src="viewSource.js">
<xsl:comment>Comment added so script is recognised</xsl:comment>
</script>
which comes out as:
<script type="text/javascript" language="JavaScript"
src="viewSource.js">
<!--Comment added so script is recognised-->
</script>
and seems to work.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|