aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-12-31 13:14:41 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-31 08:19:12 -0800
commit83ccf24e1e5e82d97f3070c1d17fdbde64c846b7 (patch)
tree53c5230ea0749167012cde5af15a51ed79b696e1
parentb3e3947b79e91d76db1d9d14f6c3701dad53a224 (diff)
downloadsubsurface-83ccf24e1e5e82d97f3070c1d17fdbde64c846b7.tar.gz
Support importing quoted multi-line notes field
This adds support for importing multi-line notes field on CSV import. Naturally the notes filed must be quoted with " in this case. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--xslt/manualcsv2xml.xslt10
1 files changed, 8 insertions, 2 deletions
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index 597b296f7..55968b512 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -55,6 +55,7 @@
<xsl:call-template name="printFields">
<xsl:with-param name="line" select="$line"/>
+ <xsl:with-param name="remaining" select="$remaining"/>
</xsl:call-template>
<xsl:if test="$remaining != ''">
@@ -67,6 +68,7 @@
<xsl:template name="printFields">
<xsl:param name="line"/>
+ <xsl:param name="remaining"/>
<xsl:variable name="number">
<xsl:choose>
@@ -313,6 +315,7 @@
<xsl:call-template name="getFieldByIndex">
<xsl:with-param name="index" select="$notesField"/>
<xsl:with-param name="line" select="$line"/>
+ <xsl:with-param name="remaining" select="$remaining"/>
</xsl:call-template>
</notes>
</xsl:if>
@@ -345,6 +348,7 @@
<xsl:template name="getFieldByIndex">
<xsl:param name="index"/>
<xsl:param name="line"/>
+ <xsl:param name="remaining"/>
<xsl:choose>
<xsl:when test="$index > 0">
<xsl:choose>
@@ -352,12 +356,14 @@
<xsl:call-template name="getFieldByIndex">
<xsl:with-param name="index" select="$index -1"/>
<xsl:with-param name="line" select="substring-after($line, $fs)"/>
+ <xsl:with-param name="remaining" select="$remaining"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="getFieldByIndex">
<xsl:with-param name="index" select="$index -1"/>
<xsl:with-param name="line" select="substring-after($line, $fs)"/>
+ <xsl:with-param name="remaining" select="$remaining"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
@@ -370,8 +376,8 @@
<xsl:value-of select="substring-before($line,'&quot;$fs')"/>
</xsl:when>
<xsl:otherwise>
- <xsl:if test="substring-after($line, '&quot;$fs') = ''">
- <xsl:value-of select="substring-before(substring-after($line, '&quot;'), '&quot;')"/>
+ <xsl:if test="substring-after(substring-after($line, '&quot;'), '&quot;') = ''">
+ <xsl:value-of select="concat(substring-after($line, '&quot;'), substring-before($remaining, '&quot;'))"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>