~ubuntu-branches/ubuntu/natty/pytrainer/natty-proposed

« back to all changes in this revision

Viewing changes to plugins/garmin-hr-file/translate.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-12-13 03:01:28 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213030128-jbu18iml98hm5yfk
Tags: 1.7.0-1ubuntu1
* Merge from debian unstable (LP: #477875), Ubuntu remaining changes:
  - Replace Depends on iceweasel with firefox | abrowser.
  - Add --install-layout=deb to setup.py install arguments to prevent FTBFS
    with Python 2.6 on Ubuntu.
  - Bump-up debhelper, python-dev build-dependencies.
* Remove python-glade2 (libglade -> gtkbuilder transition).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
 
 
3
<!-- note defining a namespace for TrainingCenterDatabase as the translation does not seem to work with a default namespace -->
 
4
<xsl:stylesheet version="1.0"
 
5
xmlns:t="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v1"
 
6
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
7
>
 
8
<xsl:output  method="xml" indent="yes" omit-xml-declaration="no"/> 
 
9
 
 
10
<!-- this is a bit of a messy way to get whitespace into the output - but it works -->
 
11
<xsl:variable name="newline"><xsl:text>
 
12
</xsl:text></xsl:variable>
 
13
 
 
14
<xsl:template match="/">
 
15
    <gpx creator="pytrainer http://sourceforge.net/projects/pytrainer" version="1.1" 
 
16
        xmlns="http://www.topografix.com/GPX/1/1"
 
17
    xmlns:gpxdata="http://www.cluetrust.com/XML/GPXDATA/1/0" >
 
18
 
 
19
    <xsl:value-of select="$newline"/>
 
20
    <xsl:variable name="sport">"Run"</xsl:variable>
 
21
    <xsl:variable name="time"><xsl:value-of select="t:Track/t:Trackpoint/t:Time"/></xsl:variable>
 
22
    <xsl:variable name="name"><xsl:value-of select="$sport"/><xsl:value-of  select="substring($time, 1,10)"/></xsl:variable>
 
23
    <metadata><xsl:value-of select="$newline"/>
 
24
    <name><xsl:value-of select="$name"/></name><xsl:value-of select="$newline"/>
 
25
    <link href="http://sourceforge.net/projects/pytrainer"/><xsl:value-of select="$newline"/>
 
26
    <time><xsl:value-of select="$time"/></time><xsl:value-of select="$newline"/>
 
27
    </metadata><xsl:value-of select="$newline"/>
 
28
    <trk><xsl:value-of select="$newline"/>
 
29
    <xsl:for-each select="t:Track">
 
30
        <trkseg><xsl:value-of select="$newline"/>
 
31
        <xsl:for-each select="t:Trackpoint">
 
32
            <!-- only output a trkpt if a position exists -->
 
33
            <xsl:if test="t:Position">
 
34
                <xsl:variable name="lat"><xsl:value-of select="t:Position/t:LatitudeDegrees"/></xsl:variable>
 
35
                <xsl:variable name="lon"><xsl:value-of select="t:Position/t:LongitudeDegrees"/></xsl:variable>
 
36
                <trkpt lat="{$lat}" lon="{$lon}"><xsl:value-of select="$newline"/>
 
37
                <ele><xsl:value-of select="t:AltitudeMeters"/></ele><xsl:value-of select="$newline"/>
 
38
                <time><xsl:value-of select="t:Time"/></time><xsl:value-of select="$newline"/>
 
39
                                <xsl:if test="t:HeartRateBpm">
 
40
                        <extensions><xsl:value-of select="$newline"/>
 
41
                    <gpxdata:hr><xsl:value-of select="t:HeartRateBpm"/></gpxdata:hr><xsl:value-of select="$newline"/>
 
42
                    </extensions><xsl:value-of select="$newline"/>
 
43
                                </xsl:if>
 
44
                </trkpt><xsl:value-of select="$newline"/>
 
45
            </xsl:if>
 
46
        </xsl:for-each>
 
47
        <xsl:value-of select="$newline"/>        
 
48
        </trkseg><xsl:value-of select="$newline"/>
 
49
    </xsl:for-each>
 
50
    </trk><xsl:value-of select="$newline"/>
 
51
    </gpx><xsl:value-of select="$newline"/>
 
52
</xsl:template>
 
53
</xsl:stylesheet>