summaryrefslogtreecommitdiffstats
path: root/xslt/SuuntoDM4.xslt
blob: 5c61c0c52448130660c64c9db120eb2d651b9ada (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:u="http://schemas.datacontract.org/2004/07/Suunto.Diving.Dal"
  version="1.0">
  <xsl:import href="commonTemplates.xsl"/>
  <xsl:strip-space elements="*"/>
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <divelog program="subsurface-import" version="2">
      <settings>
        <divecomputerid deviceid="ffffffff">
          <xsl:attribute name="model">
            <xsl:value-of select="/u:Dive/u:Source"/>
          </xsl:attribute>
          <xsl:attribute name="serial">
            <xsl:value-of select="/u:Dive/u:SourceSerialNumber"/>
          </xsl:attribute>
        </divecomputerid>
      </settings>
      <dives>
        <dive>
          <xsl:attribute name="duration">
            <xsl:call-template name="sec2time">
              <xsl:with-param name="timeSec">
                <xsl:value-of select="/u:Dive/u:DiveTime"/>
              </xsl:with-param>
            </xsl:call-template>
          </xsl:attribute>
          <xsl:call-template name="datetime">
            <xsl:with-param name="value">
              <xsl:value-of select="/u:Dive/u:StartTime"/>
            </xsl:with-param>
          </xsl:call-template>
          <xsl:if test="/u:Dive/u:Visibility != ''">
            <xsl:attribute name="visibility">
              <xsl:value-of select="/u:Dive/u:Visibility"/>
            </xsl:attribute>
          </xsl:if>
          <depth>
            <xsl:attribute name="max">
              <xsl:value-of select="/u:Dive/u:MaxDepth"/>
            </xsl:attribute>
            <xsl:attribute name="min">
              <xsl:value-of select="aou"/>
            </xsl:attribute>
          </depth>
          <xsl:for-each select="/u:Dive/u:Marks/u:Mark">
            <event>
              <xsl:attribute name="time">
                <xsl:call-template name="sec2time">
                  <xsl:with-param name="timeSec">
                    <xsl:value-of select="u:MarkTime"/>
                  </xsl:with-param>
                </xsl:call-template>
              </xsl:attribute>
              <xsl:attribute name="name">
                <xsl:choose>
                  <xsl:when test="u:Type = '19'">
                    <xsl:value-of select="'surface'"/>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="u:Type"/>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:attribute>
            </event>
          </xsl:for-each>
          <xsl:for-each select="/u:Dive/u:DiveMixtures/u:DiveMixture">
            <cylinder>
              <xsl:if test="u:Size &gt; 0">
                <xsl:attribute name="size">
                  <xsl:value-of select="u:Size"/>
                </xsl:attribute>
              </xsl:if>
              <xsl:if test="u:StartPressure &gt; 0">
                <xsl:attribute name="start">
                  <xsl:value-of select="u:StartPressure"/>
                </xsl:attribute>
                <xsl:attribute name="end">
                  <xsl:value-of select="u:EndPressure"/>
                </xsl:attribute>
              </xsl:if>
              <xsl:attribute name="o2">
                <xsl:value-of select="u:Oxygen"/>
              </xsl:attribute>
              <xsl:attribute name="he">
                <xsl:value-of select="u:Helium"/>
              </xsl:attribute>
            </cylinder>
          </xsl:for-each>
          <temperature>
            <xsl:attribute name="water">
              <xsl:value-of select="/u:Dive/u:BottomTemperature"/>
            </xsl:attribute>
            <xsl:attribute name="air">
              <xsl:value-of select="/u:Dive/u:StartTemperature"/>
            </xsl:attribute>
          </temperature>

          <notes>
            <xsl:value-of select="/u:Dive/u:Note"/>
          </notes>

          <sampleinterval>
            <xsl:value-of select="/u:Dive/u:SampleInterval"/>
          </sampleinterval>

          <xsl:if test="/u:Dive/u:Weight != ''">
            <weightsystem>
              <xsl:attribute name="weight">
                <xsl:value-of select="concat(/u:Dive/u:Weight, ' kg')"/>
              </xsl:attribute>
              <xsl:attribute name="description">
                <xsl:value-of select="'unknown'"/>
              </xsl:attribute>
            </weightsystem>
          </xsl:if>

          <blob>
            <xsl:attribute name="profileblob">
              <xsl:value-of select="/u:Dive/u:ProfileBlob"/>
            </xsl:attribute>
            <xsl:attribute name="temperatureblob">
              <xsl:value-of select="/u:Dive/u:TemperatureBlob"/>
            </xsl:attribute>
            <xsl:attribute name="pressureblob">
              <xsl:value-of select="/u:Dive/u:PressureBlob"/>
            </xsl:attribute>
          </blob>

        </dive>
      </dives>

    </divelog>
  </xsl:template>

</xsl:stylesheet>