1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | <?xml version="1.0"?> <!-- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gpx="http://www.topografix.com/GPX/1/0"> --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gpx="http://www.topografix.com/GPX/1/1"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> <xsl:apply-templates select="gpx:gpx"/> </kml> </xsl:template> <xsl:template match="gpx:gpx"> <Document> <Style id="route"> <LineStyle> <color>a02020ff</color> <width>4</width> </LineStyle> </Style> <xsl:apply-templates select="gpx:trk"/> <xsl:apply-templates select="gpx:rte"/> </Document> </xsl:template> <xsl:template match="gpx:rte"> <Placemark> <name><xsl:value-of select="gpx:name"/></name> <styleUrl>#route</styleUrl> <LineString> <extrude>1</extrude> <tessellate>1</tessellate> <coordinates> <xsl:for-each select="gpx:rtept"> <xsl:value-of select="@lon"/>,<xsl:value-of select="@lat"/> <xsl:text> </xsl:text> </xsl:for-each> </coordinates> </LineString> </Placemark> </xsl:template> <xsl:template match="gpx:trk"> <Placemark> <name><xsl:value-of select="gpx:name"/></name> <styleUrl>#route</styleUrl> <xsl:apply-templates select="gpx:trkseg"/> </Placemark> </xsl:template> <xsl:template match="gpx:trkseg"> <LineString> <tessellate>1</tessellate> <coordinates> <xsl:for-each select="gpx:trkpt"> <xsl:value-of select="@lon"/>,<xsl:value-of select="@lat"/>,<xsl:value-of select="gpx:ele"/> <xsl:text> </xsl:text> </xsl:for-each> </coordinates> </LineString> </xsl:template> </xsl:stylesheet> |