summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2018-01-07 10:07:49 +0200
committerGravatar mturkia <miika.turkia@gmail.com>2018-01-08 06:06:12 +0200
commit65c4891a71866bbd25066c54deae5fd4a0b07d7e (patch)
treeb367c66e6542d6f85727ec724122da63010d35ed
parent5046fa34a499c8f508ac47eede29311dfe56e0fc (diff)
downloadsubsurface-65c4891a71866bbd25066c54deae5fd4a0b07d7e.tar.gz
Add support for air and water temps for CSV import
Add support of importing air and water temperatures from DC header information. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--xslt/csv2xml.xslt31
1 files changed, 31 insertions, 0 deletions
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 770455a6f..d823e0ff9 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -33,6 +33,8 @@
<xsl:param name="GF" select="GF"/>
<xsl:param name="maxDepth" select="maxDepth"/>
<xsl:param name="meanDepth" select="meanDepth"/>
+ <xsl:param name="airTemp" select="airTemp"/>
+ <xsl:param name="waterTemp" select="waterTemp"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="lf"><xsl:text>
@@ -220,6 +222,35 @@
</depth>
</xsl:if>
+ <xsl:if test="string-length($airTemp) &gt; 0 or string-length($waterTemp) &gt; 0">
+ <temperature>
+ <xsl:if test="string-length($airTemp) &gt; 0">
+ <xsl:attribute name="air">
+ <xsl:choose>
+ <xsl:when test="$units = 0">
+ <xsl:value-of select="translate($airTemp, ',', '.')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(format-number((translate(translate($airTemp, translate($airTemp, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="string-length($waterTemp) &gt; 0">
+ <xsl:attribute name="water">
+ <xsl:choose>
+ <xsl:when test="$units = 0">
+ <xsl:value-of select="translate($waterTemp, ',', '.')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat(format-number((translate(translate($waterTemp, translate($waterTemp, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:if>
+ </temperature>
+ </xsl:if>
+
<xsl:call-template name="printLine">
<xsl:with-param name="line" select="substring-before(//csv, $lf)"/>
<xsl:with-param name="lineno" select="'1'"/>