CSV import: support \n as new line on notes field

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2018-06-25 18:55:23 +08:00 committed by Dirk Hohndel
parent 86988f9cdc
commit f638b7ef80

View file

@ -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>