I am an everyday runner for many years now, and the left sample is the more complex one of all my abroad runnning..
- Accessing Google Maps API by XSLT
- Overcoming Firefox XSLT problems with asynchronous Google Maps API
- DataPower considerations
Topic "Exporting gmap-pedometer.com routes in KML format (gpxs2kml.xsl)" will be subject of another posting.
Accessing Google Maps API by XSLTThere is lots of documentation and samples for the Google Maps API:
- in initialize function, create Map with specifying zoom level (maximal), center and mapType
- create an "invisible" marker (1x1 size image of transparent color) because an InfoWindow does need a marker
- create the InfoWindow with its (HTML) content for display
- open the InfoWindow and create "invisble" Marker
- in body, call initialize() and provide the map canvas for display of the map.
OK, that is easy -- so why think on XML here?
This is the (small) my_garden_office.xml I came up with:
Lets forget about the 2nd line for now, it will be discussed in next section.
The 1st line just tells which stylesheet does the transformation.
One of them is allowing to distribute the HTML InfoWindow content over several lines (will be handled by mode="oneline" templates).
The other features are:
- simple map creation
- anonymous or named Markers, with optional icon attribute
- InfoWindow with optional click handler on specified Marker
- KmlLayer for integration of Keyhole Markup Language (KML) files into Google Maps
This is the whole, less than 100 lines, stylesheet Map.xsl:
Here is the more elaborate example, with KmlLayer, for completeness (open, and do "View Page Source" in your browser):
Overcoming Firefox XSLT problems with asynchronous Google Maps API
[xsl] Q: How can Firefox access google maps api in XSLT?
- Firefox XSLT implementation directly renders the result tree of the XSLT transformation.
It does not support document.write in the result.
Warning: A call to document.write() from an asynchronously-loaded external script was ignored.
- Google Maps API DOES asynchronous document.writes
But then I remembered myself on a browser switch I used for another posting long ago.
While Firefox takes the last xml-stylesheet Processing Instruction (PI) of an input document, the other browsers take the first.
So what do we want to do for Fireffox?
That means to deploy for a given .xml file the generated (by eg. xsltproc) .html file in addition.
now you have the tools to build on/modify,