summaryrefslogtreecommitdiffstats
path: root/xslt/subsurfacecsv.xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-12-30 21:42:39 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-30 11:47:55 -0800
commitc5d3d923a0cd84b6e92e5a451a2fcead996b6e99 (patch)
treeb1df848a01740a541b565791fb50146f9fdcb522 /xslt/subsurfacecsv.xslt
parentda42b0b79ddc76e11742c47f36e6fb7310f7b773 (diff)
downloadsubsurface-c5d3d923a0cd84b6e92e5a451a2fcead996b6e99.tar.gz
Guess imperial cylinder sizes on CSV import
This patch uses pre-defined working pressures on cylinders to roughly calculate the size in liters. Imperial selection is ignored here as we can use the prefix to detect if the value seems like imperial unit (and the type of cylinder varies based on location, not divers preference in unit). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/subsurfacecsv.xslt')
-rw-r--r--xslt/subsurfacecsv.xslt20
1 files changed, 19 insertions, 1 deletions
diff --git a/xslt/subsurfacecsv.xslt b/xslt/subsurfacecsv.xslt
index 6820208e7..072dda23e 100644
--- a/xslt/subsurfacecsv.xslt
+++ b/xslt/subsurfacecsv.xslt
@@ -218,9 +218,27 @@
<xsl:with-param name="line" select="$line"/>
</xsl:call-template>
</xsl:variable>
+
+ <!-- ALxxx -> xxx cuft at 3000 psi
+ LPxxx -> xxx cuft at 2400 psi
+ HPxxx -> xxx cuft at 3440 psi -->
+
<xsl:if test="$size != ''">
<xsl:attribute name="size">
- <xsl:value-of select="$size"/>
+ <xsl:choose>
+ <xsl:when test="substring($size, 1, 2) = 'AL'">
+ <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 3000) div 0.035315, '#.#')"/>
+ </xsl:when>
+ <xsl:when test="substring($size, 1, 2) = 'LP'">
+ <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 2400) div 0.035315, '#.#')"/>
+ </xsl:when>
+ <xsl:when test="substring($size, 1, 2) = 'HP'">
+ <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 3440) div 0.035315, '#.#')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$size"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:if test="$start != ''">