[PATCH 1/2] Samples should be inside divecomputer on Shearwater import

Miika Turkia miika.turkia at gmail.com
Sun Dec 7 00:40:25 PST 2014


Data read from a divecomputer is moved inside the divecomputer tag

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/shearwater.xslt | 90 ++++++++++++++++++++++++++--------------------------
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/xslt/shearwater.xslt b/xslt/shearwater.xslt
index 0c655ad..9baff60 100644
--- a/xslt/shearwater.xslt
+++ b/xslt/shearwater.xslt
@@ -67,15 +67,6 @@
         </xsl:attribute>
       </surface>
 
-      <divecomputer>
-        <xsl:attribute name="model">
-          <xsl:value-of select="'Shearwater'"/>
-        </xsl:attribute>
-        <xsl:attribute name="deviceid">
-          <xsl:value-of select="computerSerial"/>
-        </xsl:attribute>
-      </divecomputer>
-
       <xsl:for-each select="diveLogRecords/diveLogRecord[generate-id() = generate-id(key('gases', concat(fractionO2, '/', fractionHe))[1])]">
         <xsl:if test="currentCircuitSetting = 1">
           <cylinder>
@@ -94,49 +85,58 @@
         </xsl:if>
       </xsl:for-each>
 
-      <xsl:for-each select="diveLogRecords/diveLogRecord">
-        <sample>
-          <xsl:attribute name="time">
-            <xsl:call-template name="sec2time">
-              <xsl:with-param name="timeSec">
-                <xsl:value-of select="currentTime"/>
-              </xsl:with-param>
-            </xsl:call-template>
-          </xsl:attribute>
-          <xsl:attribute name="depth">
-            <xsl:choose>
-              <xsl:when test="$units = 'imperial'">
-                <xsl:value-of select="format-number(currentDepth * 0.3048, '0.00')"/>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:value-of select="currentDepth"/>
-              </xsl:otherwise>
-            </xsl:choose>
-          </xsl:attribute>
-          <xsl:attribute name="temp">
-            <xsl:choose>
-              <xsl:when test="$units = 'imperial'">
-                <xsl:value-of select="concat(format-number((waterTemp - 32) * 5 div 9, '0.0'), ' C')"/>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:value-of select="waterTemp"/>
-              </xsl:otherwise>
-            </xsl:choose>
-          </xsl:attribute>
-          <xsl:if test="currentCircuitSetting = 0">
-            <xsl:attribute name="po2">
+      <divecomputer>
+        <xsl:attribute name="model">
+          <xsl:value-of select="'Shearwater'"/>
+        </xsl:attribute>
+        <xsl:attribute name="deviceid">
+          <xsl:value-of select="computerSerial"/>
+        </xsl:attribute>
+
+        <xsl:for-each select="diveLogRecords/diveLogRecord">
+          <sample>
+            <xsl:attribute name="time">
+              <xsl:call-template name="sec2time">
+                <xsl:with-param name="timeSec">
+                  <xsl:value-of select="currentTime"/>
+                </xsl:with-param>
+              </xsl:call-template>
+            </xsl:attribute>
+            <xsl:attribute name="depth">
               <xsl:choose>
                 <xsl:when test="$units = 'imperial'">
-                  <xsl:value-of select="concat(averagePPO2 div 14.5037738, ' bar')"/>
+                  <xsl:value-of select="format-number(currentDepth * 0.3048, '0.00')"/>
                 </xsl:when>
                 <xsl:otherwise>
-                  <xsl:value-of select="concat(averagePPO2, ' bar')"/>
+                  <xsl:value-of select="currentDepth"/>
                 </xsl:otherwise>
               </xsl:choose>
             </xsl:attribute>
-          </xsl:if>
-        </sample>
-      </xsl:for-each>
+            <xsl:attribute name="temp">
+              <xsl:choose>
+                <xsl:when test="$units = 'imperial'">
+                  <xsl:value-of select="concat(format-number((waterTemp - 32) * 5 div 9, '0.0'), ' C')"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="waterTemp"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+            <xsl:if test="currentCircuitSetting = 0">
+              <xsl:attribute name="po2">
+                <xsl:choose>
+                  <xsl:when test="$units = 'imperial'">
+                    <xsl:value-of select="concat(averagePPO2 div 14.5037738, ' bar')"/>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="concat(averagePPO2, ' bar')"/>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:attribute>
+            </xsl:if>
+          </sample>
+        </xsl:for-each>
+      </divecomputer>
     </dive>
   </xsl:template>
 </xsl:stylesheet>
-- 
1.9.1



More information about the subsurface mailing list