2013-09-29 12:44:38 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
2013-12-24 15:01:40 +00:00
|
|
|
<xsl:include href="commonTemplates.xsl"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:strip-space elements="*"/>
|
2016-05-02 17:11:33 +00:00
|
|
|
<xsl:param name="dateField" select="dateField"/>
|
2016-05-02 17:11:35 +00:00
|
|
|
<xsl:param name="datefmt" select="datefmt"/>
|
2016-05-02 17:11:36 +00:00
|
|
|
<xsl:param name="starttimeField" select="starttimeField"/>
|
2013-10-17 19:05:27 +00:00
|
|
|
<xsl:param name="timeField" select="timeField"/>
|
|
|
|
<xsl:param name="depthField" select="depthField"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:param name="tempField" select="tempField"/>
|
2013-11-21 22:48:40 +00:00
|
|
|
<xsl:param name="po2Field" select="po2Field"/>
|
2015-06-27 21:38:10 +00:00
|
|
|
<xsl:param name="o2sensor1Field" select="o2sensor1Field"/>
|
|
|
|
<xsl:param name="o2sensor2Field" select="o2sensor2Field"/>
|
|
|
|
<xsl:param name="o2sensor3Field" select="o2sensor3Field"/>
|
2013-11-21 22:48:41 +00:00
|
|
|
<xsl:param name="cnsField" select="cnsField"/>
|
2013-11-21 22:48:42 +00:00
|
|
|
<xsl:param name="otuField" select="otuField"/>
|
2014-07-09 20:13:37 +00:00
|
|
|
<xsl:param name="ndlField" select="ndlField"/>
|
2014-07-09 20:13:38 +00:00
|
|
|
<xsl:param name="ttsField" select="ttsField"/>
|
2013-11-25 22:06:00 +00:00
|
|
|
<xsl:param name="stopdepthField" select="stopdepthField"/>
|
2014-07-10 18:54:18 +00:00
|
|
|
<xsl:param name="pressureField" select="pressureField"/>
|
2015-07-21 13:37:41 +00:00
|
|
|
<xsl:param name="setpointField" select="setpointField"/>
|
2017-02-08 04:02:06 +00:00
|
|
|
<xsl:param name="numberField" select="numberField"/>
|
2013-10-19 05:17:13 +00:00
|
|
|
<xsl:param name="date" select="date"/>
|
|
|
|
<xsl:param name="time" select="time"/>
|
2014-02-15 08:51:23 +00:00
|
|
|
<xsl:param name="units" select="units"/>
|
2013-12-04 23:19:28 +00:00
|
|
|
<xsl:param name="separatorIndex" select="separatorIndex"/>
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:param name="delta" select="delta"/>
|
2015-07-27 13:13:28 +00:00
|
|
|
<xsl:param name="hw" select="hw"/>
|
2017-05-07 11:19:58 +00:00
|
|
|
<xsl:param name="diveNro" select="diveNro"/>
|
2017-05-07 12:34:27 +00:00
|
|
|
<xsl:param name="diveMode" select="diveMode"/>
|
2017-05-07 18:22:00 +00:00
|
|
|
<xsl:param name="Firmware" select="Firmware"/>
|
|
|
|
<xsl:param name="Serial" select="Serial"/>
|
|
|
|
<xsl:param name="GF" select="GF"/>
|
2018-01-07 07:58:06 +00:00
|
|
|
<xsl:param name="maxDepth" select="maxDepth"/>
|
|
|
|
<xsl:param name="meanDepth" select="meanDepth"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:output method="xml" indent="yes"/>
|
|
|
|
|
|
|
|
<xsl:variable name="lf"><xsl:text>
|
|
|
|
</xsl:text></xsl:variable>
|
2013-12-04 23:19:28 +00:00
|
|
|
<xsl:variable name="fs">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$separatorIndex = 0"><xsl:text> </xsl:text></xsl:when>
|
2014-01-13 23:12:30 +00:00
|
|
|
<xsl:when test="$separatorIndex = 2"><xsl:text>;</xsl:text></xsl:when>
|
2016-04-24 18:11:14 +00:00
|
|
|
<xsl:when test="$separatorIndex = 3"><xsl:text>|</xsl:text></xsl:when>
|
2013-12-04 23:19:28 +00:00
|
|
|
<xsl:otherwise><xsl:text>,</xsl:text></xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
2013-09-29 12:44:38 +00:00
|
|
|
|
|
|
|
<xsl:template match="/">
|
|
|
|
<divelog program="subsurface-import" version="2">
|
|
|
|
<dives>
|
|
|
|
<dive>
|
2013-10-19 05:17:13 +00:00
|
|
|
<xsl:attribute name="date">
|
2016-05-02 17:11:33 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$dateField >= 0">
|
2016-05-02 17:11:35 +00:00
|
|
|
<xsl:variable name="indate">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$dateField"/>
|
|
|
|
<xsl:with-param name="line" select="substring-after(substring-after(., $lf), $lf)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="separator">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="substring-before($indate, '.') != ''">
|
|
|
|
<xsl:value-of select="'.'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="substring-before($indate, '-') != ''">
|
|
|
|
<xsl:value-of select="'-'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="substring-before($indate, '/') != ''">
|
|
|
|
<xsl:value-of select="'/'"/>
|
|
|
|
</xsl:when>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:choose>
|
|
|
|
<!-- dd.mm.yyyy -->
|
|
|
|
<xsl:when test="$datefmt = 0">
|
|
|
|
<xsl:value-of select="translate(concat(substring-after(substring-after($indate, $separator), $separator), '-', substring-before(substring-after($indate, $separator), $separator), '-', substring-before($indate, $separator)), ' ', '')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<!-- mm.yy.yyyy -->
|
|
|
|
<xsl:when test="$datefmt = 1">
|
|
|
|
<xsl:value-of select="translate(concat(substring-after(substring-after($indate, $separator), $separator), '-', substring-before($indate, $separator), '-', substring-before(substring-after($indate, $separator), $separator)), ' ', '')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<!-- yyyy.mm.dd -->
|
|
|
|
<xsl:when test="$datefmt = 2">
|
|
|
|
<xsl:value-of select="translate(concat(substring-before($indate, $separator), '-', substring-before(substring-after($indate, $separator), $separator), '-', substring-after(substring-after($indate, $separator), $separator)), ' ', '')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="'1900-1-1'"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2016-05-02 17:11:33 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat(substring($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-10-19 05:17:13 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
<xsl:attribute name="time">
|
2016-05-02 17:11:36 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$starttimeField >= 0">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$starttimeField"/>
|
|
|
|
<xsl:with-param name="line" select="substring-after(substring-after(., $lf), $lf)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-10-19 05:17:13 +00:00
|
|
|
</xsl:attribute>
|
2015-07-27 13:13:27 +00:00
|
|
|
|
2016-05-02 17:11:37 +00:00
|
|
|
<xsl:if test="$numberField >= 0">
|
|
|
|
<xsl:attribute name="number">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$numberField"/>
|
|
|
|
<xsl:with-param name="line" select="substring-after(substring-after(., $lf), $lf)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2017-05-07 11:19:58 +00:00
|
|
|
<xsl:if test="string-length($diveNro) > 0">
|
|
|
|
<xsl:attribute name="number">
|
|
|
|
<xsl:value-of select="$diveNro"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2015-07-27 13:13:27 +00:00
|
|
|
<!-- If the dive is CCR, create oxygen and diluent cylinders -->
|
|
|
|
|
|
|
|
<xsl:if test="$po2Field >= 0 or $setpointField >= 0 or $o2sensor1Field >= 0 or $o2sensor2Field >= 0 or $o2sensor3Field >= 0">
|
|
|
|
<cylinder description='oxygen' o2="100.0%" use='oxygen' />
|
|
|
|
<cylinder description='diluent' o2="21.0%" use='diluent' />
|
|
|
|
</xsl:if>
|
|
|
|
|
2015-07-27 13:13:28 +00:00
|
|
|
<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>
|
2015-07-21 13:37:41 +00:00
|
|
|
<xsl:if test="$po2Field >= 0 or $setpointField >= 0 or $o2sensor1Field >= 0 or $o2sensor2Field >= 0 or $o2sensor3Field >= 0">
|
2015-06-27 21:38:12 +00:00
|
|
|
<xsl:attribute name="dctype">CCR</xsl:attribute>
|
2015-06-27 21:38:13 +00:00
|
|
|
<xsl:attribute name="no_o2sensors">
|
|
|
|
<xsl:copy-of select="number($o2sensor1Field >= 0) + number($o2sensor2Field >= 0) + number($o2sensor3Field >= 0)" />
|
|
|
|
</xsl:attribute>
|
2015-06-27 21:38:12 +00:00
|
|
|
</xsl:if>
|
2017-05-07 12:34:27 +00:00
|
|
|
|
|
|
|
<!-- Seabear specific dive modes -->
|
|
|
|
<xsl:if test="string-length($diveMode) > 0">
|
|
|
|
<xsl:if test="$diveMode = 'OC' or $diveMode = 'APNEA' or $diveMode = 'CCR' or $diveMode = 'CCR SENSORBOARD'">
|
|
|
|
<xsl:attribute name="dctype">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$diveMode = 'APNEA'">
|
|
|
|
<xsl:value-of select="'Freedive'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:when test="$diveMode = 'CCR' or $diveMode = 'CCR SENSORBOARD' ">
|
|
|
|
<xsl:value-of select="'CCR'"/>
|
|
|
|
</xsl:when>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:if>
|
|
|
|
|
2017-05-07 18:22:00 +00:00
|
|
|
<xsl:if test="string-length($Firmware) > 0">
|
|
|
|
<extradata key="Firmware version">
|
|
|
|
<xsl:attribute name="Value">
|
|
|
|
<xsl:value-of select="$Firmware"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</extradata>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:if test="string-length($Serial) > 0">
|
|
|
|
<extradata key="Serial number">
|
|
|
|
<xsl:attribute name="Value">
|
|
|
|
<xsl:value-of select="$Serial"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</extradata>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:if test="string-length($GF) > 0">
|
|
|
|
<extradata key="Gradient factors">
|
|
|
|
<xsl:attribute name="Value">
|
|
|
|
<xsl:value-of select="$GF"/>
|
|
|
|
</xsl:attribute>
|
|
|
|
</extradata>
|
|
|
|
</xsl:if>
|
|
|
|
|
2018-01-07 07:58:06 +00:00
|
|
|
<xsl:if test="string-length($maxDepth) > 0 or string-length($meanDepth) > 0">
|
|
|
|
<depth>
|
|
|
|
<xsl:if test="string-length($maxDepth) > 0">
|
|
|
|
<xsl:attribute name="max">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 0">
|
|
|
|
<xsl:value-of select="translate($maxDepth, ',', '.')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="round(translate(translate($maxDepth, translate($maxDepth, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
<xsl:if test="string-length($meanDepth) > 0">
|
|
|
|
<xsl:attribute name="mean">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 0">
|
|
|
|
<xsl:value-of select="translate($meanDepth, ',', '.')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="round(translate(translate($meanDepth, translate($meanDepth, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
</depth>
|
|
|
|
</xsl:if>
|
|
|
|
|
2015-06-27 21:38:11 +00:00
|
|
|
<xsl:call-template name="printLine">
|
|
|
|
<xsl:with-param name="line" select="substring-before(//csv, $lf)"/>
|
|
|
|
<xsl:with-param name="lineno" select="'1'"/>
|
|
|
|
<xsl:with-param name="remaining" select="substring-after(//csv, $lf)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</divecomputer>
|
2013-09-29 12:44:38 +00:00
|
|
|
</dive>
|
|
|
|
</dives>
|
|
|
|
</divelog>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template name="printLine">
|
|
|
|
<xsl:param name="line"/>
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:param name="lineno"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:param name="remaining"/>
|
2013-10-17 19:05:28 +00:00
|
|
|
|
2014-01-15 16:47:22 +00:00
|
|
|
<!-- We only want to process lines with different time stamps, and
|
|
|
|
timeField is not necessarily the first field -->
|
|
|
|
<xsl:if test="$line != substring-before($remaining, $lf)">
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$delta != '' and $delta > 0">
|
|
|
|
<xsl:variable name="curTime">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$timeField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="prevTime">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$timeField"/>
|
|
|
|
<xsl:with-param name="line" select="substring-before($remaining, $lf)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<xsl:if test="$curTime != $prevTime">
|
|
|
|
<xsl:call-template name="printFields">
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
<xsl:with-param name="lineno" select="$lineno"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:call-template name="printFields">
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
<xsl:with-param name="lineno" select="'0'"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2014-01-15 16:47:22 +00:00
|
|
|
|
2013-10-17 19:05:28 +00:00
|
|
|
</xsl:if>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:if test="$remaining != ''">
|
|
|
|
<xsl:call-template name="printLine">
|
|
|
|
<xsl:with-param name="line" select="substring-before($remaining, $lf)"/>
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:with-param name="lineno" select="$lineno + 1"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:with-param name="remaining" select="substring-after($remaining, $lf)"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template name="printFields">
|
|
|
|
<xsl:param name="line"/>
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:param name="lineno"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
|
|
|
|
<xsl:variable name="value">
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$delta != '' and $delta > 0">
|
|
|
|
<xsl:value-of select="'1'"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$timeField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-09-29 12:44:38 +00:00
|
|
|
</xsl:variable>
|
|
|
|
|
2015-03-22 15:13:47 +00:00
|
|
|
|
2016-11-09 19:39:23 +00:00
|
|
|
<xsl:if test="number(translate($value, ',', '.')) = translate($value, ',', '.') or number(substring-before($value, ':')) = substring-before($value, ':')">
|
2013-09-29 12:44:38 +00:00
|
|
|
<sample>
|
|
|
|
<xsl:attribute name="time">
|
|
|
|
<xsl:choose>
|
2015-03-22 15:13:47 +00:00
|
|
|
<xsl:when test="$delta != '' and $delta > 0">
|
|
|
|
<xsl:call-template name="sec2time">
|
|
|
|
<xsl:with-param name="timeSec">
|
2015-10-01 11:51:09 +00:00
|
|
|
<xsl:value-of select="$lineno * $delta"/>
|
2015-03-22 15:13:47 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
2016-11-09 19:39:23 +00:00
|
|
|
<xsl:when test="number(translate($value, ',', '.')) = translate($value, ',', '.')">
|
2013-09-29 12:44:38 +00:00
|
|
|
|
2016-11-09 19:39:26 +00:00
|
|
|
<!-- We assume time in seconds with possibly fractions -->
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:call-template name="sec2time">
|
|
|
|
<xsl:with-param name="timeSec">
|
2016-04-24 18:11:22 +00:00
|
|
|
<xsl:choose>
|
2017-01-10 18:48:55 +00:00
|
|
|
<xsl:when test="substring-after($value, '.') != '' and not(contains($hw, 'APD'))">
|
2016-04-24 18:11:22 +00:00
|
|
|
<!-- Well, I suppose it was min.sec -->
|
2016-11-10 04:47:44 +00:00
|
|
|
<xsl:value-of select="substring-before($value, '.') * 60 + concat('.', substring-after($value, '.')) * 60" />
|
2016-04-24 18:11:22 +00:00
|
|
|
</xsl:when>
|
2016-11-09 19:39:23 +00:00
|
|
|
<xsl:when test="substring-after($value, ',') != ''">
|
2016-11-10 04:47:44 +00:00
|
|
|
<xsl:value-of select="substring-before($value, ',') * 60 + concat('.', substring-after($value, ',')) * 60" />
|
2016-11-09 19:39:23 +00:00
|
|
|
</xsl:when>
|
2016-04-24 18:11:22 +00:00
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="$value"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-09-29 12:44:38 +00:00
|
|
|
</xsl:with-param>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:when>
|
2014-07-28 05:18:39 +00:00
|
|
|
<xsl:when test="substring-after(substring-after($value, ':'), ':') = ''">
|
|
|
|
<!-- We assume time format m:s -->
|
|
|
|
|
|
|
|
<xsl:value-of select="substring-before($value, ':') * 60 + substring-after($value, ':')" />
|
|
|
|
</xsl:when>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:otherwise>
|
|
|
|
<!-- We assume time format h:m:s -->
|
|
|
|
|
|
|
|
<xsl:value-of select="concat(
|
|
|
|
substring-before($value, ':') * 60 + substring-before(substring-after($value, ':'), ':'),
|
|
|
|
':',
|
|
|
|
substring-after(substring-after($value, ':'), ':')
|
|
|
|
)" />
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
|
2014-02-15 08:51:23 +00:00
|
|
|
<xsl:variable name="depth">
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:call-template name="getFieldByIndex">
|
2013-10-17 19:05:27 +00:00
|
|
|
<xsl:with-param name="index" select="$depthField"/>
|
2013-09-29 12:44:38 +00:00
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
2014-02-15 08:51:23 +00:00
|
|
|
</xsl:variable>
|
|
|
|
<xsl:attribute name="depth">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 0">
|
2016-11-09 19:39:24 +00:00
|
|
|
<xsl:value-of select="translate($depth, ',', '.')"/>
|
2014-02-15 08:51:23 +00:00
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
2017-05-09 19:56:57 +00:00
|
|
|
<xsl:value-of select="round(translate(translate($depth, translate($depth, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000"/>
|
2014-02-15 08:51:23 +00:00
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-09-29 12:44:38 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
|
2013-11-25 22:06:01 +00:00
|
|
|
<xsl:if test="$tempField >= 0">
|
2014-02-15 08:51:23 +00:00
|
|
|
<xsl:variable name="temp">
|
2013-11-25 22:06:01 +00:00
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$tempField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
2014-02-15 08:51:23 +00:00
|
|
|
</xsl:variable>
|
2017-03-30 04:07:13 +00:00
|
|
|
<xsl:if test="$temp != ''">
|
|
|
|
<xsl:attribute name="temp">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 0">
|
|
|
|
<xsl:value-of select="translate($temp, ',', '.')"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat(format-number((translate(translate($temp, translate($temp, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-11-25 22:06:01 +00:00
|
|
|
</xsl:if>
|
2013-11-21 22:48:40 +00:00
|
|
|
|
2015-07-21 13:37:41 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$setpointField >= 0">
|
|
|
|
<xsl:attribute name="po2">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$setpointField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:if test="$po2Field >= 0">
|
|
|
|
<xsl:attribute name="po2">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$po2Field"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-11-21 22:48:41 +00:00
|
|
|
|
2015-06-27 21:38:10 +00:00
|
|
|
<xsl:if test="$o2sensor1Field >= 0">
|
|
|
|
<xsl:attribute name="sensor1">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$o2sensor1Field"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:if test="$o2sensor2Field >= 0">
|
|
|
|
<xsl:attribute name="sensor2">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$o2sensor2Field"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
|
|
|
<xsl:if test="$o2sensor3Field >= 0">
|
|
|
|
<xsl:attribute name="sensor3">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$o2sensor3Field"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-11-25 22:06:01 +00:00
|
|
|
<xsl:if test="$cnsField >= 0">
|
|
|
|
<xsl:attribute name="cns">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$cnsField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-11-21 22:48:42 +00:00
|
|
|
|
2013-11-25 22:06:01 +00:00
|
|
|
<xsl:if test="$otuField >= 0">
|
|
|
|
<xsl:attribute name="otu">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$otuField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2013-11-25 22:06:00 +00:00
|
|
|
|
2014-07-09 20:13:37 +00:00
|
|
|
<xsl:if test="$ndlField >= 0">
|
|
|
|
<xsl:attribute name="ndl">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$ndlField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2014-07-09 20:13:38 +00:00
|
|
|
<xsl:if test="$ttsField >= 0">
|
|
|
|
<xsl:attribute name="tts">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$ttsField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
|
|
|
|
2013-11-25 22:06:00 +00:00
|
|
|
<xsl:if test="$stopdepthField >= 0">
|
|
|
|
<xsl:variable name="stopdepth">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$stopdepthField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:attribute name="stopdepth">
|
2014-02-15 08:51:23 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 0">
|
|
|
|
<xsl:copy-of select="$stopdepth"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:copy-of select="format-number($stopdepth * 0.3048, '0.00')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2013-11-25 22:06:00 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
|
|
|
|
<xsl:attribute name="in_deco">
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$stopdepth > 0">1</xsl:when>
|
|
|
|
<xsl:otherwise>0</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2014-07-10 18:54:18 +00:00
|
|
|
|
|
|
|
<xsl:if test="$pressureField >= 0">
|
2017-03-30 04:10:36 +00:00
|
|
|
<xsl:variable name="pressure">
|
|
|
|
<xsl:call-template name="getFieldByIndex">
|
|
|
|
<xsl:with-param name="index" select="$pressureField"/>
|
|
|
|
<xsl:with-param name="line" select="$line"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:if test="$pressure >= 0">
|
|
|
|
<xsl:attribute name="pressure">
|
2016-11-03 15:36:57 +00:00
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$units = 0">
|
|
|
|
<xsl:value-of select="$pressure"/>
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:value-of select="concat(format-number(($pressure div 14.5037738007), '#'), ' bar')"/>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
2017-03-30 04:10:36 +00:00
|
|
|
</xsl:attribute>
|
|
|
|
</xsl:if>
|
2014-07-10 18:54:18 +00:00
|
|
|
</xsl:if>
|
2013-09-29 12:44:38 +00:00
|
|
|
</sample>
|
|
|
|
</xsl:if>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|