Subject: [xsl] Q: How can Firefox access google maps api in XSLT? From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx> Date: Thu, 25 Oct 2012 19:49:54 +0200 |
Hello, after I found out on how easy the JavaScript Google Maps API is to use, I played a bit and created this simple HTML page: http://www.stamm-wilbrandt.de/en/xsl-list/gmap/my_garden_office.html This works fine for all BIG5 browsers. Now I wanted to remove redundancy and use XML and a stylesheet to generate the same. This works well for Chrome, Internet Explorer, Opera and Safari browsers: http://www.stamm-wilbrandt.de/en/xsl-list/gmap/my_garden_office.xml (uses http://www.stamm-wilbrandt.de/en/xsl-list/gmap/markers.xsl) Only Firefox does not work and complains in Error Console: Error: uncaught exception: [Exception... "An attempt was made to use an object that is not, or is no longer, usable" code: "11" nsresult: "0x8053000b (NS_ERROR_DOM_INVALID_STATE_ERR)" location: "http://maps.google.com/maps/api/js?sensor=false Line: 9"] Error: google.maps.LatLng is not a constructor Source File: http://www.stamm-wilbrandt.de/en/xsl-list/gmap/my_garden_office.xml Line: 7 OK, now I really simplified the sample to a minimum. The XML does not work for Firefox with the same error message, while the XHTML is fine: http://www.stamm-wilbrandt.de/en/xsl-list/gmap/s.xml http://www.stamm-wilbrandt.de/en/xsl-list/gmap/s.html Given the simplicity and that s.xsl just copies the XHTML file s.html I have no idea on what to do to make Firefox work with Google Maps API (v3) in a stylesheet: $ cat s.xml <?xml-stylesheet href="s.xsl" type="text/xsl"?> <dummy/> $ $ cat s.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="html"/> <xsl:template match="/"> <xsl:copy-of select="document('s.html')"/> </xsl:template> </xsl:stylesheet> $ $ cat s.html <html> <head> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng(49.450523,8.976758); var options = { zoom: 21, center: latlng, mapTypeId: google.maps.MapTypeId.HYBRID }; var map = new google.maps.Map(document.getElementById('map'), options); }; </script> </head> <body onload="initialize()"> <div id="map" style="width:900px; height:600px"/> </body> </html> $ Some years ago I had a stylesheet+image problem and got help (quirks mode) here. How can Google Maps API be accessed from a stylesheet for all BIG5 browsers? Mit besten Gruessen / Best wishes, Hermann Stamm-Wilbrandt Level 3 support for XML Compiler team and Fixpack team lead WebSphere DataPower SOA Appliances https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/ https://twitter.com/#!/HermannSW/ ---------------------------------------------------------------------- IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Effect of default namespa, Ihe Onwuka | Thread | Re: [xsl] Q: How can Firefox access, Martin Honnen |
Re: [xsl] Effect of default namespa, Ihe Onwuka | Date | Re: [xsl] Re: XPath as a stand-alon, Mukul Gandhi |
Month |