diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2017-07-12 07:28:55 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-15 14:44:07 +0900 |
commit | 24614a989f6ad887f5cad9f610fae602593f2333 (patch) | |
tree | 69f276df3320c7f9fb7d218f63327d0651a5bba6 /xslt | |
parent | 0135597265cbd63211bd5d2c222a5c4d58e4c0d4 (diff) | |
download | subsurface-24614a989f6ad887f5cad9f610fae602593f2333.tar.gz |
Reflect import of subsurfaceCSV with having units in headers
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/subsurfacecsv.xslt | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/xslt/subsurfacecsv.xslt b/xslt/subsurfacecsv.xslt index 871d70f99..e4c3106bb 100644 --- a/xslt/subsurfacecsv.xslt +++ b/xslt/subsurfacecsv.xslt @@ -134,7 +134,7 @@ <xsl:value-of select="$max"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($max, ' ') * 0.3048), '#.##'), ' m')"/> + <xsl:value-of select="concat(round(translate(translate($max, translate($max, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000, ' m')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -146,7 +146,7 @@ <xsl:value-of select="$mean"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($mean, ' ') * 0.3048), '#.##'), ' m')"/> + <xsl:value-of select="concat(round(translate(translate($mean, translate($mean, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000, ' m')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -173,7 +173,7 @@ <xsl:value-of select="$air"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($air, ' ') - 32) * 5 div 9, '0.0'), ' C')"/> + <xsl:value-of select="concat(format-number((translate(translate($air, translate($air, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -185,7 +185,7 @@ <xsl:value-of select="$water"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($water, ' ') - 32) * 5 div 9, '0.0'), ' C')"/> + <xsl:value-of select="concat(format-number((translate(translate($water, translate($water, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -241,7 +241,14 @@ <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: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.035315, '#.#')"/> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -258,7 +265,7 @@ <xsl:value-of select="$start"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($start, ' ') div 14.5037738007), '#'), ' bar')"/> + <xsl:value-of select="concat(format-number((translate($start, translate($start, '0123456789', ''), '') div 14.5037738007), '#'), ' bar')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -270,7 +277,7 @@ <xsl:value-of select="$end"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($end, ' ') div 14.5037738007), '#'), ' bar')"/> + <xsl:value-of select="concat(format-number((translate($end, translate($end, '0123456789', ''), '') div 14.5037738007), '#'), ' bar')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> @@ -373,7 +380,7 @@ <xsl:value-of select="$weight"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat(format-number((substring-before($weight, ' ') * 0.453592), '#.##'), ' kg')"/> + <xsl:value-of select="concat(format-number((translate($weight, translate($weight, '0123456789', ''), '') * 0.453592), '#.##'), ' kg')"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> |