Skip to content

Instantly share code, notes, and snippets.

@Jakuje
Last active August 29, 2015 14:17
Show Gist options
  • Save Jakuje/6773ad26b0baafd91af7 to your computer and use it in GitHub Desktop.
Save Jakuje/6773ad26b0baafd91af7 to your computer and use it in GitHub Desktop.
Simple transformation for GPX files into files readable by Navit mobile navigation (with specialization for Geocaching)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://www.topografix.com/GPX/1/0">
<xsl:output method="text"/>
<xsl:template match="g:gpx">
<xsl:for-each select="g:wpt">
<xsl:choose>
<xsl:when test="g:type = 'Waypoint|Parking Area'">
<xsl:text>type=poi_car_parking label="</xsl:text>
</xsl:when>
<xsl:when test="starts-with(g:type, 'Geocache')">
<xsl:text>type=poi_attraction label="</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>type=poi_other label="</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="g:name"/>
<xsl:text>" description="</xsl:text>
<xsl:value-of select="g:desc"/>
<xsl:text>" gc_type="</xsl:text>
<xsl:value-of select="g:type"/>
<xsl:text>"
</xsl:text>
<xsl:value-of select="@lon"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@lat"/>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment