[PATCH 2/2] Tidy up csv to xml xslt
Anton Lundin
glance at acc.umu.se
Mon Nov 25 14:06:01 UTC 2013
Use if around the attribute, instead if a choose inside. Its less
horrible on the eyes.
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
xslt/csv2xml.xslt | 72 +++++++++++++++++++++++++------------------------------
1 file changed, 32 insertions(+), 40 deletions(-)
diff --git a/xslt/csv2xml.xslt b/xslt/csv2xml.xslt
index 8017c45..fda0b67 100644
--- a/xslt/csv2xml.xslt
+++ b/xslt/csv2xml.xslt
@@ -99,49 +99,41 @@
</xsl:call-template>
</xsl:attribute>
- <xsl:attribute name="temp">
- <xsl:choose>
- <xsl:when test="$tempField >= 0">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$tempField"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:attribute>
+ <xsl:if test="$tempField >= 0">
+ <xsl:attribute name="temp">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$tempField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
- <xsl:attribute name="po2">
- <xsl:choose>
- <xsl:when test="$po2Field >= 0">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$po2Field"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:attribute>
+ <xsl:if test="$po2Field >= 0">
+ <xsl:attribute name="po2">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$po2Field"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
- <xsl:attribute name="cns">
- <xsl:choose>
- <xsl:when test="$cnsField >= 0">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$cnsField"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:attribute>
+ <xsl:if test="$cnsField >= 0">
+ <xsl:attribute name="cns">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$cnsField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
- <xsl:attribute name="otu">
- <xsl:choose>
- <xsl:when test="$otuField >= 0">
- <xsl:call-template name="getFieldByIndex">
- <xsl:with-param name="index" select="$otuField"/>
- <xsl:with-param name="line" select="$line"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:attribute>
+ <xsl:if test="$otuField >= 0">
+ <xsl:attribute name="otu">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$otuField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
<xsl:if test="$stopdepthField >= 0">
<xsl:variable name="stopdepth">
--
1.8.3.2
More information about the subsurface
mailing list