diff options
-rw-r--r-- | xslt/av1.xslt | 146 |
1 files changed, 124 insertions, 22 deletions
diff --git a/xslt/av1.xslt b/xslt/av1.xslt index e5f73fa88..9ac25413f 100644 --- a/xslt/av1.xslt +++ b/xslt/av1.xslt @@ -28,6 +28,12 @@ <xsl:value-of select="$hw" /> </xsl:attribute> + <xsl:if test="substring-before(//AV1, 'DiveMode=') != ''"> + <xsl:attribute name="dctype"> + <xsl:value-of select="substring-before(substring-after(//AV1, 'DiveMode= '), ' ')"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="printLine"> <xsl:with-param name="line" select="substring-before(//AV1, $lf)"/> <xsl:with-param name="lineno" select="'1'"/> @@ -44,13 +50,42 @@ <xsl:param name="lineno"/> <xsl:param name="remaining"/> - <!-- For now, parse only depth values - they are numeric --> - <xsl:if test="string(number(substring($line, 1, 1))) != 'NaN'"> - <xsl:call-template name="printFields"> - <xsl:with-param name="line" select="$line"/> - <xsl:with-param name="lineno" select="'0'"/> - </xsl:call-template> - </xsl:if> + <xsl:choose> + <xsl:when test="string(number(substring($line, 1, 1))) != 'NaN'"> + <sample> + <xsl:call-template name="printFields"> + <xsl:with-param name="line" select="$line"/> + <xsl:with-param name="lineno" select="'0'"/> + </xsl:call-template> + <xsl:if test="$remaining != ''"> + <xsl:call-template name="findTemp"> + <xsl:with-param name="line" select="substring-before($remaining, $lf)"/> + <xsl:with-param name="remaining" select="substring-after($remaining, $lf)"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="$remaining != ''"> + <xsl:call-template name="findNDL"> + <xsl:with-param name="line" select="substring-before($remaining, $lf)"/> + <xsl:with-param name="remaining" select="substring-after($remaining, $lf)"/> + </xsl:call-template> + </xsl:if> + </sample> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="substring-before($line, '=') = 'Alert'"> + <event> + <xsl:attribute name="time"> + <xsl:value-of select="substring-before($remaining, ' ')"/> + </xsl:attribute> + <xsl:attribute name="name"> + <xsl:value-of select="substring-after($line, '= ')"/> + </xsl:attribute> + </event> + </xsl:when> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> <xsl:if test="$remaining != ''"> <xsl:call-template name="printLine"> @@ -71,21 +106,88 @@ <xsl:with-param name="line" select="$line"/> </xsl:call-template> </xsl:variable> - <sample> - <xsl:attribute name="time"> - <xsl:value-of select="substring-before($value, ':') * 60 + substring-after($value, ':')" /> - </xsl:attribute> - - <xsl:variable name="depth"> - <xsl:call-template name="getFieldByIndex"> - <xsl:with-param name="index" select="$depthField"/> - <xsl:with-param name="line" select="$line"/> - </xsl:call-template> - </xsl:variable> - <xsl:attribute name="depth"> - <xsl:value-of select="translate($depth, ',', '.')"/> - </xsl:attribute> - </sample> + <xsl:attribute name="time"> + <xsl:value-of select="substring-before($value, ':') * 60 + substring-after($value, ':')" /> + </xsl:attribute> + + <xsl:variable name="depth"> + <xsl:call-template name="getFieldByIndex"> + <xsl:with-param name="index" select="$depthField"/> + <xsl:with-param name="line" select="$line"/> + </xsl:call-template> + </xsl:variable> + <xsl:attribute name="depth"> + <xsl:value-of select="translate($depth, ',', '.')"/> + </xsl:attribute> + </xsl:template> + + <xsl:template name="findTemp"> + <xsl:param name="line"/> + <xsl:param name="remaining"/> + + <xsl:if test="string(number(substring($line, 1, 1))) = 'NaN'"> + <xsl:choose> + <xsl:when test="substring-before($line, '=') = 'Temp'"> + <xsl:attribute name="temp"> + <xsl:value-of select="substring-after($line, '= ')"/> + </xsl:attribute> + </xsl:when> + + <xsl:otherwise> + <xsl:if test="$remaining != ''"> + <xsl:call-template name="findTemp"> + <xsl:with-param name="line" select="substring-before($remaining, $lf)"/> + <xsl:with-param name="remaining" select="substring-after($remaining, $lf)"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + + <xsl:template name="findNDL"> + <xsl:param name="line"/> + <xsl:param name="remaining"/> + + <xsl:if test="string(number(substring($line, 1, 1))) = 'NaN'"> + <xsl:choose> + <xsl:when test="substring-before($line, '=') = 'NDL'"> + <xsl:if test="substring-after($line, '= -') = ''"> + <xsl:variable name="value"> + <xsl:value-of select="substring-after($line, '= ')"/> + </xsl:variable> + <xsl:attribute name="ndl"> + <xsl:value-of select="concat(floor($value div 60), ':', format-number($value mod 60, '00'), ' min')"/> + </xsl:attribute> + </xsl:if> + </xsl:when> + + <xsl:when test="substring-before($line, '=') = 'DecoSel'"> + <xsl:variable name="value"> + <xsl:value-of select="substring-after($line, '= ')"/> + </xsl:variable> + <xsl:attribute name="in_deco"> + <xsl:choose> + <xsl:when test="$value > 0"> + <xsl:value-of select="'1'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'0'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </xsl:when> + + <xsl:otherwise> + <xsl:if test="$remaining != ''"> + <xsl:call-template name="findNDL"> + <xsl:with-param name="line" select="substring-before($remaining, $lf)"/> + <xsl:with-param name="remaining" select="substring-after($remaining, $lf)"/> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:if> </xsl:template> </xsl:stylesheet> |