[PATCH] Support PSI on CSV import

Miika Turkia miika.turkia at gmail.com
Sun Jan 24 12:19:06 PST 2016


Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 xslt/csv2xml.xslt | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 2d48de1..903f455 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -334,10 +334,20 @@
 
         <xsl:if test="$pressureField >= 0">
           <xsl:attribute name="pressure">
-            <xsl:call-template name="getFieldByIndex">
-              <xsl:with-param name="index" select="$pressureField"/>
-              <xsl:with-param name="line" select="$line"/>
-            </xsl:call-template>
+            <xsl:variable name="pressure">
+              <xsl:call-template name="getFieldByIndex">
+                <xsl:with-param name="index" select="$pressureField"/>
+                <xsl:with-param name="line" select="$line"/>
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:choose>
+              <xsl:when test="$units = 0">
+                <xsl:value-of select="$pressure"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="concat(format-number(($pressure div 14.5037738007), '#'), ' bar')"/>
+              </xsl:otherwise>
+            </xsl:choose>
           </xsl:attribute>
         </xsl:if>
       </sample>
-- 
2.5.0



More information about the subsurface mailing list