[PATCH 6/8] Support for multiple cylinders on UDDF export

Miika Turkia miika.turkia at gmail.com
Fri Dec 27 23:05:36 UTC 2013


Adding support for multiple cylinders on UDDF export. This also adds a
cylinder reference to the tankdata to enable mix lookups.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/uddf-export.xslt | 79 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 47 insertions(+), 32 deletions(-)

diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt
index 3002469..e82b29d 100644
--- a/xslt/uddf-export.xslt
+++ b/xslt/uddf-export.xslt
@@ -359,43 +359,58 @@
         </xsl:for-each>
       </samples>
 
-      <tankdata>
-        <xsl:if test="cylinder[1]/@size">
-          <tankvolume>
-            <xsl:value-of select="substring-before(cylinder[1]/@size, ' ')"/>
-          </tankvolume>
-        </xsl:if>
-        <xsl:choose>
-          <xsl:when test="divecomputer[1]/sample/@pressure != ''">
-            <tankpressurebegin>
-              <xsl:value-of select="substring-before(divecomputer[1]/sample/@pressure[1], ' ') * 100000"/>
-            </tankpressurebegin>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:if test="cylinder[1]/@start">
+      <xsl:for-each select="cylinder">
+        <tankdata>
+          <link>
+            <xsl:attribute name="ref">
+              <xsl:choose>
+                <xsl:when test="@o2 != ''">
+                  <xsl:value-of select="substring-before(@o2, '.')"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="'21'"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:attribute>
+          </link>
+
+          <xsl:if test="@size">
+            <tankvolume>
+              <xsl:value-of select="substring-before(@size, ' ')"/>
+            </tankvolume>
+          </xsl:if>
+          <xsl:choose>
+            <xsl:when test="divecomputer[1]/sample/@pressure != ''">
               <tankpressurebegin>
-                <xsl:value-of select="substring-before(cylinder[1]/@start, ' ') * 100000"/>
+                <xsl:value-of select="substring-before(divecomputer[1]/sample/@pressure[1], ' ') * 100000"/>
               </tankpressurebegin>
-            </xsl:if>
-          </xsl:otherwise>
-        </xsl:choose>
-
-        <xsl:choose>
-          <xsl:when test="count(divecomputer[1]/sample[@pressure]) > 0">
-            <tankpressureend>
-              <xsl:value-of select="substring-before(divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') * 100000"/>
-            </tankpressureend>
-          </xsl:when>
-          <xsl:otherwise>
-            <xsl:if test="cylinder[1]/@end">
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:if test="@start">
+                <tankpressurebegin>
+                  <xsl:value-of select="substring-before(@start, ' ') * 100000"/>
+                </tankpressurebegin>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
+
+          <xsl:choose>
+            <xsl:when test="count(divecomputer[1]/sample[@pressure]) > 0">
               <tankpressureend>
-                <xsl:value-of select="substring-before(cylinder[1]/@end, ' ') * 100000"/>
+                <xsl:value-of select="substring-before(divecomputer[1]/sample[@pressure][last()]/@pressure, ' ') * 100000"/>
               </tankpressureend>
-            </xsl:if>
-          </xsl:otherwise>
-        </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:if test="@end">
+                <tankpressureend>
+                  <xsl:value-of select="substring-before(@end, ' ') * 100000"/>
+                </tankpressureend>
+              </xsl:if>
+            </xsl:otherwise>
+          </xsl:choose>
 
-      </tankdata>
+        </tankdata>
+      </xsl:for-each>
 
       <informationafterdive>
         <xsl:if test="node()/depth/@max != ''">
-- 
1.8.3.2



More information about the subsurface mailing list