summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-03-29 20:03:06 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-04-01 08:06:09 -0700
commit62c7abc2a8b463d4922e90a772083d2625bab30b (patch)
tree013d1c8355acfa635535aa390e22415bce65bd88
parent919cfc9deed532bfae9c5da510ebe778dc39760b (diff)
downloadsubsurface-62c7abc2a8b463d4922e90a772083d2625bab30b.tar.gz
Only import weight if available
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--xslt/manualcsv2xml.xslt39
1 files changed, 21 insertions, 18 deletions
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index e563dea03..3f7f15d8a 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -421,24 +421,27 @@
</xsl:if>
<xsl:if test="$weightField >= 0">
- <weightsystem description="imported">
- <xsl:attribute name="weight">
- <xsl:variable name="weight">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$weightField"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$units = 0">
- <xsl:value-of select="translate($weight, translate($weight, '1234567890,.', ''), '')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate(translate($weight, translate($weight, '1234567890,.', ''), ''), ',', '.') div 2.2046"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- </weightsystem>
+ <xsl:variable name="weight">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$weightField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="translate($weight, translate($weight, '1234567890,.', ''), '') > 0">
+ <weightsystem description="imported">
+ <xsl:attribute name="weight">
+ <xsl:choose>
+ <xsl:when test="$units = 0">
+ <xsl:value-of select="translate($weight, translate($weight, '1234567890,.', ''), '')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="translate(translate($weight, translate($weight, '1234567890,.', ''), ''), ',', '.') div 2.2046"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </weightsystem>
+ </xsl:if>
</xsl:if>
</dive>