[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Q: How can Firefox access google maps api in XSLT?

Subject: 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
 Q: How can Firefox access google maps api in XSLT?
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.