diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-12-31 22:09:38 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-12-31 12:13:04 -0800 |
commit | 77a7595cbd649b4f7623d3bd7db3eb14ed68e9db (patch) | |
tree | cddcc14f6e54bdfe9bc2cc6c7c134c5aa6c17da4 /xslt/xml2csv.xslt | |
parent | ed89febcbbb90b98b6d9d6b331be51a1ec2c15d7 (diff) | |
download | subsurface-77a7595cbd649b4f7623d3bd7db3eb14ed68e9db.tar.gz |
Imperial support for CSV profile export
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt/xml2csv.xslt')
-rw-r--r-- | xslt/xml2csv.xslt | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/xslt/xml2csv.xslt b/xslt/xml2csv.xslt index 3ba6b85be..86739a627 100644 --- a/xslt/xml2csv.xslt +++ b/xslt/xml2csv.xslt @@ -1,6 +1,7 @@ <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="*"/> + <xsl:param name="units" select="units"/> <xsl:output method="text" encoding="UTF-8"/> <xsl:variable name="fs">,</xsl:variable> @@ -31,16 +32,37 @@ <xsl:value-of select="$fs"/> <xsl:value-of select="concat('"', substring-before(@time, ' '), '"')"/> <xsl:value-of select="$fs"/> - <xsl:value-of select="concat('"', substring-before(@depth, ' '), '"')"/> + <xsl:choose> + <xsl:when test="$units = 1"> + <xsl:value-of select="concat('"', format-number((substring-before(@depth, ' ') div 0.3048), '#.#'), ' ft"')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('"', substring-before(@depth, ' '), '"')"/> + </xsl:otherwise> + </xsl:choose> <xsl:value-of select="$fs"/> <xsl:if test="@temp != ''"> - <xsl:value-of select="concat('"', substring-before(@temp, ' '), '"')"/> + <xsl:choose> + <xsl:when test="$units = 1"> + <xsl:value-of select="concat('"', format-number((substring-before(@temp, ' ') * 1.8) + 32, '#.#'), ' F"')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('"', substring-before(@temp, ' '), '"')"/> + </xsl:otherwise> + </xsl:choose> </xsl:if> <xsl:value-of select="$fs"/> <xsl:if test="@pressure != ''"> - <xsl:value-of select="concat('"', substring-before(@pressure, ' '), '"')"/> + <xsl:choose> + <xsl:when test="$units = 1"> + <xsl:value-of select="concat('"', format-number((substring-before(@pressure, ' ') * 14.5037738007), '#'), ' psi"')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('"', substring-before(@pressure, ' '), '"')"/> + </xsl:otherwise> + </xsl:choose> </xsl:if> <xsl:text> |