Created
October 9, 2017 05:25
-
-
Save mlc/5a587b0502138ae11f63075cfa84c11c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns="http://www.topografix.com/GPX/1/1" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:date="http://exslt.org/dates-and-times" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
extension-element-prefixes="date"> | |
<xsl:output method="xml" indent="yes" encoding="utf-8"/> | |
<xsl:template match="/index"> | |
<gpx version="1.1" creator="flickrdownload-to-gpx" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3"> | |
<metadata> | |
<name><xsl:value-of select="user/username"/></name> | |
<desc>Flickr Photos</desc> | |
<link> | |
<xsl:attribute name="href"><xsl:value-of select="user/flickrUrls/@photos"/></xsl:attribute> | |
<text>Photos</text> | |
</link> | |
<time><xsl:value-of select="date:date-time()"/></time> | |
</metadata> | |
<xsl:for-each select="all_media/media[geodata/@latitude and string-length(geodata/@latitude)!=0 and privacy/@public='1']"> | |
<xsl:variable name="rawdate" select="dates/taken/@raw"/> | |
<wpt> | |
<xsl:attribute name="lat"><xsl:value-of select="geodata/@latitude"/></xsl:attribute> | |
<xsl:attribute name="lon"><xsl:value-of select="geodata/@longitude"/></xsl:attribute> | |
<time><xsl:value-of select="substring($rawdate,1,10)"/>T<xsl:value-of select="substring($rawdate,12,8)"/>Z</time> | |
<name><xsl:value-of select="title"/></name> | |
<desc><xsl:value-of select="description"/></desc> | |
<link><xsl:attribute name="href"><xsl:value-of select="publicUrl"/></xsl:attribute></link> | |
</wpt> | |
</xsl:for-each> | |
</gpx> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment