mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
CSV export: show units on header
Let's show the units in CSV header so the actual fields have only the values. This should be easier to parse with some other programs. Fixes #472 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
9397dbb432
commit
9b7d321c87
1 changed files with 11 additions and 4 deletions
|
@ -7,7 +7,14 @@
|
||||||
<xsl:variable name="fs">,</xsl:variable>
|
<xsl:variable name="fs">,</xsl:variable>
|
||||||
|
|
||||||
<xsl:template match="/divelog/dives">
|
<xsl:template match="/divelog/dives">
|
||||||
<xsl:value-of select="concat('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"sample time"', $fs, '"sample depth"', $fs, '"sample temperature"', $fs, '"sample pressure"')"/>
|
<xsl:choose>
|
||||||
|
<xsl:when test="$units = 1">
|
||||||
|
<xsl:value-of select="concat('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"sample time"', $fs, '"sample depth (ft)"', $fs, '"sample temperature (F)"', $fs, '"sample pressure (psi)"')"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="concat('"dive number"', $fs, '"date"', $fs, '"time"', $fs, '"sample time"', $fs, '"sample depth (m)"', $fs, '"sample temperature (C)"', $fs, '"sample pressure (bar)"')"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
<xsl:apply-templates select="dive|trip/dive"/>
|
<xsl:apply-templates select="dive|trip/dive"/>
|
||||||
|
@ -34,7 +41,7 @@
|
||||||
<xsl:value-of select="$fs"/>
|
<xsl:value-of select="$fs"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$units = 1">
|
<xsl:when test="$units = 1">
|
||||||
<xsl:value-of select="concat('"', round((substring-before(@depth, ' ') div 0.3048) * 1000) div 1000, ' ft"')"/>
|
<xsl:value-of select="concat('"', round((substring-before(@depth, ' ') div 0.3048) * 1000) div 1000, '"')"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat('"', round(substring-before(@depth, ' ') * 1000) div 1000, '"')"/>
|
<xsl:value-of select="concat('"', round(substring-before(@depth, ' ') * 1000) div 1000, '"')"/>
|
||||||
|
@ -45,7 +52,7 @@
|
||||||
<xsl:if test="@temp != ''">
|
<xsl:if test="@temp != ''">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$units = 1">
|
<xsl:when test="$units = 1">
|
||||||
<xsl:value-of select="concat('"', format-number((substring-before(@temp, ' ') * 1.8) + 32, '#.#'), ' F"')"/>
|
<xsl:value-of select="concat('"', format-number((substring-before(@temp, ' ') * 1.8) + 32, '#.#'), '"')"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat('"', substring-before(@temp, ' '), '"')"/>
|
<xsl:value-of select="concat('"', substring-before(@temp, ' '), '"')"/>
|
||||||
|
@ -57,7 +64,7 @@
|
||||||
<xsl:if test="@pressure != ''">
|
<xsl:if test="@pressure != ''">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$units = 1">
|
<xsl:when test="$units = 1">
|
||||||
<xsl:value-of select="concat('"', format-number((substring-before(@pressure, ' ') * 14.5037738007), '#'), ' psi"')"/>
|
<xsl:value-of select="concat('"', format-number((substring-before(@pressure, ' ') * 14.5037738007), '#'), '"')"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat('"', substring-before(@pressure, ' '), '"')"/>
|
<xsl:value-of select="concat('"', substring-before(@pressure, ' '), '"')"/>
|
||||||
|
|
Loading…
Reference in a new issue