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

Subject: Re: [xsl] Q: How can Firefox access google maps api in XSLT?
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Sun, 28 Oct 2012 01:59:50 +0100
Thanks Martin,

> As far as I can tell the problem with Firefox is likely caused by an
> attempt to use the DOM's document.write method to inject a script
> element dynamically. That is done by the Google maps code you include it
> seems.
>
it seems that you did hit the bull's eye.

> ...
> I don't see an easy workaround, unless Google provides an API or a way
> to use the maps code without relying on document.write.
>
And since its a Javascript API, they might not even care on XSLT.


I was able to prove that your explanation is correct by getting this
Firefox
error console message:

Warning: A call to document.write() from an asynchronously-loaded external
script was ignored.
Source File: http://stamm-wilbrandt.de/en/xsl-list/gmap/s.ff.html
Line: 0


For that I made use of the Javascript XSLTProcessor directly in HTML page:
http://stamm-wilbrandt.de/en/xsl-list/gmap/s.ff.html

That page loads stylesheet "s.xsl", XML document "s.xml" and then
transforms.


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


|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Martin Honnen <Martin.Honnen@xxxxxx>                                                                                                              |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |xsl-list@xxxxxxxxxxxxxxxxxxxxxx,                                                                                                                  |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |10/26/2012 11:14 AM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [xsl] Q: How can Firefox access google maps api in XSLT?                                                                                      |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





Hermann Stamm-Wilbrandt wrote:

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

As far as I can tell the problem with Firefox is likely caused by an
attempt to use the DOM's document.write method to inject a script
element dynamically. That is done by the Google maps code you include it
seems.
As Firefox's XSLT implementation directly renders the result tree of the
XSLT transformation is does not support document.write in the result
document (see
https://developer.mozilla.org/en-US/docs/XSL_Transformations_in_Mozilla_FAQ#What_about_document.write.3F
).

I don't see an easy workaround, unless Google provides an API or a way
to use the maps code without relying on document.write.

--

		 Martin Honnen --- MVP Data Platform Development
		 http://msmvps.com/blogs/martin_honnen/

Current Thread