Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rmtsrc/baad49fcea3b0659824c to your computer and use it in GitHub Desktop.
Save rmtsrc/baad49fcea3b0659824c to your computer and use it in GitHub Desktop.
Converts a Ride with GPS GPX Route cuesheet into a format that can be used within a Garmin TCX file
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gpx="http://www.topografix.com/GPX/1/1">
<xsl:template match="/">
<TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd">
<Courses>
<Course>
<xsl:for-each select="//gpx:rtept">
<CoursePoint>
<Name><xsl:value-of select="gpx:name"/></Name>
<Time>2000-01-01T00:00:00Z</Time>
<Position>
<LatitudeDegrees><xsl:value-of select="@lat"/></LatitudeDegrees>
<LongitudeDegrees><xsl:value-of select="@lon"/></LongitudeDegrees>
</Position>
<AltitudeMeters>0</AltitudeMeters>
<PointType><xsl:value-of select="gpx:name"/></PointType>
<Notes><xsl:value-of select="gpx:cmt"/></Notes>
</CoursePoint>
</xsl:for-each>
</Course>
</Courses>
</TrainingCenterDatabase>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment