PDA

View Full Version : XSL Not Working in Netscape/Mozilla


virtualshock
06-26-2003, 11:43 PM
I'm having trouble getting the following code to work in NN 7 and Mozilla 1. It works in IE 6 just fine, but the <script></script> tags cause the page not to display in NN7. If I take them out, everything works fine. Any ideas? Thanks.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">

<xsl:template match="/">
<!-- BEGIN HTML CODE -->
<html xmlns="http://www.w3.org/1999/xhtml">

<!-- BEGIN PAGE HEAD -->
<head>
<title>Weblog Template</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../../private/styles/master.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../../layout.js"></script>
</head>
<!-- END PAGE HEAD -->

<!-- BEGIN PAGE BODY -->
<body>
<!-- BEGIN PAGE HEADER AND NAVIGATION -->
<div id="header">
<div id="navigation"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="500" height="50">
<param name="movie" value="../private/flash/nav_bar.swf" />
<param name="quality" value="high" />
<embed src="../../private/flash/nav_bar.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="500" height="50"></embed></object></div>
</div>
<!-- END PAGE HEADER AND NAVIGATION -->

<xsl:apply-templates select="weblog/topic"/>

<!-- BEGIN PAGE FOOTER -->
<div id="footer"></div>
<!-- END PAGE FOOTER -->

</body>
<!-- END PAGE BODY -->
</html>
<!-- END HTML CODE -->
</xsl:template>

<xsl:template match="topic">
<!-- BEGIN WEBLOG ENTRIES -->
<div id="topic">
<h1><!--script type="text/javascript">WriteHeading('<xsl:value-of select="heading"/>');</script--></h1>
<xsl:for-each select="entry">
<h2 class="date"><xsl:value-of select="date"/></h2>
<h3><xsl:value-of select="text"/></h3>
</xsl:for-each>
</div>
<!-- END WEBLOG ENTRIES -->
</xsl:template>

</xsl:stylesheet>

Skyzyx
06-27-2003, 01:45 AM
Most likely, you need to declare the script as CDATA...


<script xmlns="http://www.w3.org/1999/xhtml" type="application/x-javascript">
<![CDATA[

// script here

]]>
</script>

virtualshock
06-27-2003, 07:32 PM
Thanks for the suggestion, but it doesn't seem to work. I went to a page demonstrating using javascript inside an xsl file and it loads just fine. This file just doesn't want to for some reason.

djmothra
06-30-2003, 04:03 PM
not sure if my answer will help you, but i can make javascript work fine in IE6 and NS7 etc.
I have the actual javascript code in the .htm or .asp page with the parser on, rather than on the xsl page.

theabyss
07-01-2003, 03:59 AM
Try to have the script in an external .js file. That might work. :cool: