[PATCH 1/6] CSV import: convert cylinder size from imperial
Miika Turkia
miika.turkia at gmail.com
Mon May 2 10:11:32 PDT 2016
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 at gmail.com>
---
xslt/manualcsv2xml.xslt | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index cae2b62..4f79463 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -264,10 +264,20 @@
<cylinder>
<xsl:if test="$cylindersizeField > 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 > 0">
--
2.5.0
More information about the subsurface
mailing list