[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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

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


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:

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:
(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:
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:

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"?>
$ cat s.xsl
<xsl:stylesheet version="1.0"
  <xsl:output method="html"/>

  <xsl:template match="/">
    <xsl:copy-of select="document('s.html')"/>
$ cat s.html
    <script type="text/javascript"
    <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'),

  <body onload="initialize()">
    <div id="map" style="width:900px; height:600px"/>

Some years ago I had a stylesheet+image problem and got help (quirks mode)

How can Google Maps API be accessed from a stylesheet for all BIG5

Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Level 3 support for XML Compiler team and Fixpack team lead
WebSphere DataPower SOA Appliances
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

Current Thread