Changeset 9b7d321 in subsurface


Ignore:
Timestamp:
Jul 14, 2017, 10:44:07 PM (6 days ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
0135597
Parents:
9397dbb
git-author:
Miika Turkia <miika.turkia@…> (07/09/17 01:16:28)
git-committer:
Dirk Hohndel <dirk@…> (07/14/17 22:44:07)
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • xslt/xml2csv.xslt

    ra489b3f r9b7d321  
    88
    99  <xsl:template match="/divelog/dives">
    10     <xsl:value-of select="concat('&quot;dive number&quot;', $fs, '&quot;date&quot;', $fs, '&quot;time&quot;', $fs, '&quot;sample time&quot;', $fs, '&quot;sample depth&quot;', $fs, '&quot;sample temperature&quot;', $fs, '&quot;sample pressure&quot;')"/>
     10    <xsl:choose>
     11      <xsl:when test="$units = 1">
     12        <xsl:value-of select="concat('&quot;dive number&quot;', $fs, '&quot;date&quot;', $fs, '&quot;time&quot;', $fs, '&quot;sample time&quot;', $fs, '&quot;sample depth (ft)&quot;', $fs, '&quot;sample temperature (F)&quot;', $fs, '&quot;sample pressure (psi)&quot;')"/>
     13      </xsl:when>
     14      <xsl:otherwise>
     15        <xsl:value-of select="concat('&quot;dive number&quot;', $fs, '&quot;date&quot;', $fs, '&quot;time&quot;', $fs, '&quot;sample time&quot;', $fs, '&quot;sample depth (m)&quot;', $fs, '&quot;sample temperature (C)&quot;', $fs, '&quot;sample pressure (bar)&quot;')"/>
     16      </xsl:otherwise>
     17    </xsl:choose>
    1118    <xsl:text>
    1219</xsl:text>
     
    3542      <xsl:choose>
    3643        <xsl:when test="$units = 1">
    37           <xsl:value-of select="concat('&quot;', round((substring-before(@depth, ' ') div 0.3048) * 1000) div 1000, ' ft&quot;')"/>
     44          <xsl:value-of select="concat('&quot;', round((substring-before(@depth, ' ') div 0.3048) * 1000) div 1000, '&quot;')"/>
    3845        </xsl:when>
    3946        <xsl:otherwise>
     
    4653        <xsl:choose>
    4754          <xsl:when test="$units = 1">
    48             <xsl:value-of select="concat('&quot;', format-number((substring-before(@temp, ' ') * 1.8) + 32, '#.#'), ' F&quot;')"/>
     55            <xsl:value-of select="concat('&quot;', format-number((substring-before(@temp, ' ') * 1.8) + 32, '#.#'), '&quot;')"/>
    4956          </xsl:when>
    5057          <xsl:otherwise>
     
    5865        <xsl:choose>
    5966          <xsl:when test="$units = 1">
    60             <xsl:value-of select="concat('&quot;', format-number((substring-before(@pressure, ' ') * 14.5037738007), '#'), ' psi&quot;')"/>
     67            <xsl:value-of select="concat('&quot;', format-number((substring-before(@pressure, ' ') * 14.5037738007), '#'), '&quot;')"/>
    6168          </xsl:when>
    6269          <xsl:otherwise>
Note: See TracChangeset for help on using the changeset viewer.