summaryrefslogtreecommitdiffstats
path: root/xslt
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-05-02 20:11:32 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-05-02 10:24:47 -0700
commit98f93be0c4168d42a6b2f2fa9bd3fcc9f9d9a4f7 (patch)
tree578e3e8040cb024d88bd4846bcf62b9dbed27c9b /xslt
parent7dde9b25d84317288cec6fbda97b43c445954df2 (diff)
downloadsubsurface-98f93be0c4168d42a6b2f2fa9bd3fcc9f9d9a4f7.tar.gz
CSV import: convert cylinder size from imperial
This will convert cylinder size when importing from imperial units. I am using default working pressure of 3000 PSI that is not precisely correct, but should be close enough for the most common aluminium cylinders. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt')
-rw-r--r--xslt/manualcsv2xml.xslt18
1 files changed, 14 insertions, 4 deletions
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index cae2b62e1..4f794630d 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -264,10 +264,20 @@
<cylinder>
<xsl:if test="$cylindersizeField &gt; 0">
<xsl:attribute name="size">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$cylindersizeField"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
+ <xsl:variable name="size">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$cylindersizeField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$units = 0">
+ <xsl:value-of select="$size"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 3000) div 0.35315, '#.#')"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:if test="$startpressureField &gt; 0">