Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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