Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I've got the following situation:
I've got the following code
Part of XML
<?xml version="1.0" encoding="UTF-8" standalone="no" ?><?xml-stylesheet type="text/xsl" href="/scripts/GPX2GoogleMaps.xml" ?><gpx xmlns="http://www.topografix.com/GPX/1/1" creator="MapSource 6.16.2" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata> <link href="http://www.garmin.com"> <text>Garmin International</text> </link> <time>2010-10-18T17:36:58Z</time> <bounds maxlat="51.288602985441685" maxlon="6.068652961403132" minlat="51.280394000932574" minlon="6.049582036212087"/> </metadata>
<trk> <name>Current Track: 06 OCT 2010 11:39</name> <trkseg> <trkpt lat="51.280898004770279" lon="6.049635009840131"> <ele>30.899999999999999</ele> <time>2010-10-06T09:39:11Z</time> </trkpt> <trkpt lat="51.280898004770279" lon="6.049635009840131"> <ele>34.259999999999998</ele> <time>2010-10-06T09:39:40Z</time> </trkpt> <trkpt lat="51.280898004770279" lon="6.049635009840131"> <ele>34.259999999999998</ele> <time>2010-10-06T09:39:41Z</time> </trkpt> <trkpt lat="51.280898004770279" lon="6.049628974869847"> <ele>28.02</ele> <time>2010-10-06T09:39:58Z</time> </trkpt> <trkpt lat="51.280898004770279" lon="6.049628974869847"> <ele>31.859999999999999</ele> <time>2010-10-06T09:40:00Z</time> </trkpt> <trkpt lat="51.280898004770279" lon="6.049628974869847"> <ele>32.82</ele> <time>2010-10-06T09:40:02Z</time> </trkpt> <trkpt lat="51.28090001642704" lon="6.049637021496892"> <ele>32.82</ele> <time>2010-10-06T09:40:41Z</time> </trkpt> </trkseg> </trk>
XSL
<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method = "text" version="1.0" encoding="utf-8" />
<xsl:template match="/"> <xsl:apply-templates select="*[local-name()='gpx']"/> </xsl:template>
<xsl:template match="*[local-name()='gpx']"> var map = new GMap(document.getElementById("map")); map.setMapType(G_HYBRID_MAP) map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); var points = []; <xsl:apply-templates select="*[local-name()='trk']/*[local-name()='trkseg']/*[local-name()='trkpt']"/> map.addOverlay(new GPolyline(points)); </xsl:template>
<xsl:template match="*[local-name()='trk']/*[local-name()='trkseg']/*[local-name()='trkpt']"> <xsl:if test="position() = 1"> map.centerAndZoom(new GPoint(<xsl:value-of select="@lon"/>, <xsl:value-of select="@lat"/> ), 5); </xsl:if> points.push(new GPoint(<xsl:value-of select="@lon"/>, <xsl:value-of select="@lat"/> )); </xsl:template>
</xsl:stylesheet>
Masterpage
<asp:content ContentPlaceHolderId="head" runat="server"> <script type="text/javascript"> //<![CDATA[ function onLoad() { <umbraco:Macro Alias="GPX2GoogleMaps" runat="server"></umbraco:Macro> } //]]> </script>
</asp:content>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How is this approach and could it be better?
Hi,
I've got the following situation:
I've got the following code
Part of XML
XSL
Masterpage
is working on a reply...