[PATCH 3/3] CSV import: imperial support for cylinder pressure

Miika Turkia miika.turkia at gmail.com
Thu Jul 30 22:19:39 PDT 2015


Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/manualcsv2xml.xslt | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index 7690926..cae2b62 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -272,18 +272,38 @@
           </xsl:if>
           <xsl:if test="$startpressureField > 0">
             <xsl:attribute name="start">
-              <xsl:call-template name="getFieldByIndex">
-                <xsl:with-param name="index" select="$startpressureField"/>
-                <xsl:with-param name="line" select="$line"/>
-              </xsl:call-template>
+              <xsl:variable name="start">
+                <xsl:call-template name="getFieldByIndex">
+                  <xsl:with-param name="index" select="$startpressureField"/>
+                  <xsl:with-param name="line" select="$line"/>
+                </xsl:call-template>
+              </xsl:variable>
+              <xsl:choose>
+                <xsl:when test="$units = 0">
+                  <xsl:value-of select="$start"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="format-number($start div 14.5037738, '#.###')"/>
+                </xsl:otherwise>
+              </xsl:choose>
             </xsl:attribute>
           </xsl:if>
           <xsl:if test="$endpressureField > 0">
             <xsl:attribute name="end">
-              <xsl:call-template name="getFieldByIndex">
-                <xsl:with-param name="index" select="$endpressureField"/>
-                <xsl:with-param name="line" select="$line"/>
-              </xsl:call-template>
+              <xsl:variable name="end">
+                <xsl:call-template name="getFieldByIndex">
+                  <xsl:with-param name="index" select="$endpressureField"/>
+                  <xsl:with-param name="line" select="$line"/>
+                </xsl:call-template>
+              </xsl:variable>
+              <xsl:choose>
+                <xsl:when test="$units = 0">
+                  <xsl:value-of select="$end"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="format-number($end div 14.5037738, '#.###')"/>
+                </xsl:otherwise>
+              </xsl:choose>
             </xsl:attribute>
           </xsl:if>
           <xsl:if test="$o2Field > 0">
-- 
2.1.4



More information about the subsurface mailing list