diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2018-06-25 18:55:23 +0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-06-25 20:12:06 +0800 |
commit | f638b7ef8054e09dfb81829c04c03f0b2ececf65 (patch) | |
tree | 0d2fed1dd8d1403d76ff30a42f46fa153f74cae9 /xslt | |
parent | 86988f9cdcca0e6233775c22a607b0b599b092a6 (diff) | |
download | subsurface-f638b7ef8054e09dfb81829c04c03f0b2ececf65.tar.gz |
CSV import: support \n as new line on notes field
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/manualcsv2xml.xslt | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt index 2382ddb01..b899d0655 100644 --- a/xslt/manualcsv2xml.xslt +++ b/xslt/manualcsv2xml.xslt @@ -431,12 +431,17 @@ </xsl:if> <xsl:if test="$notesField >= 0"> - <notes> + <xsl:variable name="note"> <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> + </xsl:variable> + <notes> + <xsl:call-template name="new-line"> + <xsl:with-param name="str" select="$note" /> + </xsl:call-template> </notes> </xsl:if> @@ -468,4 +473,20 @@ </xsl:if> </xsl:template> + <xsl:template name="new-line"> + <xsl:param name="str"/> + <xsl:choose> + <xsl:when test="contains($str, '\n')"> + <xsl:value-of select="substring-before($str, '\n')"/> + <xsl:value-of select="$lf"/> + <xsl:call-template name="new-line"> + <xsl:with-param name="str" select="substring-after($str, '\n')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$str"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + </xsl:stylesheet> |