[PATCH 2/7] CSV import: add XSLT support for DC hw info

Miika Turkia miika.turkia at gmail.com
Mon Jul 27 06:13:28 PDT 2015


Include the DC's hardware name if it was given as parameter on CSV
import.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/csv2xml.xslt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index f2d652e..dda876a 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -21,6 +21,7 @@
   <xsl:param name="units" select="units"/>
   <xsl:param name="separatorIndex" select="separatorIndex"/>
   <xsl:param name="delta" select="delta"/>
+  <xsl:param name="hw" select="hw"/>
   <xsl:output method="xml" indent="yes"/>
 
   <xsl:variable name="lf"><xsl:text>
@@ -51,7 +52,19 @@
             <cylinder description='diluent' o2="21.0%" use='diluent' />
           </xsl:if>
 
-          <divecomputer model="Imported from CSV" deviceid="ffffffff">
+          <divecomputer deviceid="ffffffff">
+            <xsl:choose>
+              <xsl:when test="string-length($hw) > 0">
+                <xsl:attribute name="model">
+                  <xsl:value-of select="$hw" />
+                </xsl:attribute>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:attribute name="model">
+                  <xsl:value-of select="'Imported from CSV'" />
+                </xsl:attribute>
+              </xsl:otherwise>
+            </xsl:choose>
             <xsl:if test="$po2Field >= 0 or $setpointField >= 0 or $o2sensor1Field >= 0 or $o2sensor2Field >= 0 or $o2sensor3Field >= 0">
               <xsl:attribute name="dctype">CCR</xsl:attribute>
               <xsl:attribute name="no_o2sensors">
-- 
2.1.4



More information about the subsurface mailing list