XSL, Javascript and Google maps..
Hey all,
I'm really scratching my head over this problem here. I'm trying to get an XSL transformation to display google maps. I've stripped down the very basics and used the Google Maps Hello World script, but in XSL formatting.
The problem? It works fine and dandy in IE, but not in Firefox.
I tried the same hello world script in HTML format and it worked fine in both browsers.
Heres my script:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAArwtl8H-0vkbKUJQSKii7aBSmvnqj_jvWX9jzbAfFZqVyU1JN7hRy418Mp VHZx_OGhzqNA5ya6la-ZQ"
language="text/javascript" />
<script language="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}
//]]>
</script>
</head>
<body onload_="load()" onunload_="GUnload()">
hello
<div id="map" style="width:500px; height:300px;"></div>
<br />boo
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I've tried removing the slashes surrounding the CDATA as advised on other forums, but that didn't make any difference.
The 'hello' and 'boo' are just there for no reason at all.
I'm really really stumped. Whats worse is that this is for a final year project which makes it 10x worse!!
Using the web developer toolbar, i outputted the generated source and the second <script> tags come back as normal text. The CDATA only appears as slashes, whereas in the HTML version it appears in its entirety.
Could anyone tell me what I'm doing drastically wrong, before my skull cracks from banging it on the desk?
Thanks in advance,
Tom
|