diff options
-rw-r--r-- | xslt/csv2xml.xslt | 31 |
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) > 0 or string-length($waterTemp) > 0"> + <temperature> + <xsl:if test="string-length($airTemp) > 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) > 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'"/> |