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

« back to all changes in this revision

Viewing changes to plugins/garmintools_full/translate.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-02-04 06:07:11 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100204060711-25n5aw66w5egeiph
Tags: 1.7.1-1ubuntu1
* Merge from debian testing, remaining changes:
  - debian/control:
    + Replace Depends on iceweasel with firefox | abrowser.
    + Bump python-dev,debhelper build-dependencies.
    - Drop dependency on python-glade2 (libglade -> gtkbuilder transition).
  - debian/rules:
    + Append --install-laoyut=deb to setup.py install to prevent a build
      failure with Python 2.6.

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/v2"
 
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"><xsl:value-of select="root/run/@sport"/></xsl:variable>
 
21
    <xsl:variable name="time"><xsl:value-of select="root/point/@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
        <trkseg><xsl:value-of select="$newline"/>
 
30
        <!-- <xsl:variable name="calories"><xsl:value-of select="t:Calories"/></xsl:variable> -->
 
31
        <xsl:for-each select="root/point">
 
32
                                <xsl:if test="@lat"> <!-- only write trkpt if lat/lon exist -->
 
33
                        <xsl:variable name="lat"><xsl:value-of select="@lat"/></xsl:variable>
 
34
                    <xsl:variable name="lon"><xsl:value-of select="@lon"/></xsl:variable>
 
35
                    <trkpt lat="{$lat}" lon="{$lon}"><xsl:value-of select="$newline"/>
 
36
                    <ele><xsl:value-of select="@alt"/></ele><xsl:value-of select="$newline"/>
 
37
                    <time><xsl:value-of select="@time"/></time><xsl:value-of select="$newline"/>
 
38
                                        <xsl:if test="@hr">
 
39
                                <extensions><xsl:value-of select="$newline"/>
 
40
                            <gpxdata:hr><xsl:value-of select="@hr"/></gpxdata:hr><xsl:value-of select="$newline"/>
 
41
                            </extensions><xsl:value-of select="$newline"/>
 
42
                                        </xsl:if>
 
43
                    </trkpt><xsl:value-of select="$newline"/>
 
44
                                </xsl:if> 
 
45
        </xsl:for-each>
 
46
        <xsl:value-of select="$newline"/>        
 
47
        </trkseg><xsl:value-of select="$newline"/>
 
48
    </trk><xsl:value-of select="$newline"/>
 
49
 
 
50
<!-- Lap Data -->
 
51
        <xsl:value-of select="$newline"/>
 
52
        <extensions><xsl:value-of select="$newline"/>
 
53
    <xsl:for-each select="root/lap">
 
54
    <xsl:variable name="vIndex">
 
55
    <xsl:number count="lap"/>
 
56
    </xsl:variable>
 
57
                <gpxdata:lap><xsl:value-of select="$newline"/>
 
58
                        <gpxdata:index><xsl:value-of select="$vIndex"/></gpxdata:index><xsl:value-of select="$newline"/>
 
59
            <xsl:variable name="stlat"><xsl:value-of select="begin_pos/@lat"/></xsl:variable>
 
60
            <xsl:variable name="stlon"><xsl:value-of select="begin_pos/@lon"/></xsl:variable>
 
61
            <gpxdata:startPoint lat="{$stlat}" lon="{$stlon}"/><xsl:value-of select="$newline"/>
 
62
            <xsl:variable name="endlat"><xsl:value-of select="end_pos/@lat"/></xsl:variable>
 
63
            <xsl:variable name="endlon"><xsl:value-of select="end_pos/@lon"/></xsl:variable>
 
64
            <gpxdata:endPoint lat="{$endlat}" lon="{$endlon}"/><xsl:value-of select="$newline"/>
 
65
                        <gpxdata:startTime><xsl:value-of select="@start"/></gpxdata:startTime><xsl:value-of select="$newline"/>
 
66
                        <gpxdata:elapsedTime><xsl:value-of select="@duration"/></gpxdata:elapsedTime><xsl:value-of select="$newline"/> <!-- Needs converting to seconds -->
 
67
                        <gpxdata:calories><xsl:value-of select="calories"/></gpxdata:calories><xsl:value-of select="$newline"/>
 
68
                        <gpxdata:distance><xsl:value-of select="@distance"/></gpxdata:distance><xsl:value-of select="$newline"/>
 
69
                        <gpxdata:summary><xsl:value-of select="$newline"/>
 
70
                                <MaximumSpeed kind="max"><xsl:value-of select="max_speed"/></MaximumSpeed><xsl:value-of select="$newline"/>
 
71
                                <AverageHeartRateBpm kind="avg"><xsl:value-of select="avg_hr"/></AverageHeartRateBpm><xsl:value-of select="$newline"/>
 
72
                                <MaximumHeartRateBpm kind="max"><xsl:value-of select="max_hr"/></MaximumHeartRateBpm><xsl:value-of select="$newline"/>
 
73
                        </gpxdata:summary><xsl:value-of select="$newline"/> 
 
74
                        <gpxdata:trigger><xsl:value-of select="@trigger"/></gpxdata:trigger><xsl:value-of select="$newline"/>
 
75
                        <gpxdata:intensity><xsl:value-of select="intensity"/></gpxdata:intensity><xsl:value-of select="$newline"/>
 
76
                </gpxdata:lap><xsl:value-of select="$newline"/>
 
77
    </xsl:for-each>
 
78
    </extensions><xsl:value-of select="$newline"/>
 
79
 
 
80
    </gpx><xsl:value-of select="$newline"/>
 
81
</xsl:template>
 
82
</xsl:stylesheet>