diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-01-05 10:53:23 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-05 09:13:35 -0800 |
commit | 182ea3ea6cd103ca3f69f1d06eb0223ce2bfa0a7 (patch) | |
tree | 7837a51a930804c240fc2dfbb12a01531bc8acf5 /xslt | |
parent | a409c73195fb9d79637e560394d8c6b07c8513ca (diff) | |
download | subsurface-182ea3ea6cd103ca3f69f1d06eb0223ce2bfa0a7.tar.gz |
Support for multi-line notes on SubsurfaceCSV import
This patch only implements the feature, indentation fix is to follow.
This ensures that the actual change can be more easily reviewed.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/subsurfacecsv.xslt | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/xslt/subsurfacecsv.xslt b/xslt/subsurfacecsv.xslt index 3afbd0341..077ec6cb6 100644 --- a/xslt/subsurfacecsv.xslt +++ b/xslt/subsurfacecsv.xslt @@ -33,6 +33,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 != ''"> @@ -45,8 +46,15 @@ <xsl:template name="printFields"> <xsl:param name="line"/> + <xsl:param name="remaining"/> - + <xsl:variable name="number"> + <xsl:call-template name="getFieldByIndex"> + <xsl:with-param name="index" select="0"/> + <xsl:with-param name="line" select="$line"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$number >= 0"> <dive> <xsl:attribute name="date"> <xsl:call-template name="getFieldByIndex"> @@ -63,10 +71,7 @@ </xsl:attribute> <xsl:attribute name="number"> - <xsl:call-template name="getFieldByIndex"> - <xsl:with-param name="index" select="0"/> - <xsl:with-param name="line" select="$line"/> - </xsl:call-template> + <xsl:value-of select="$number"/> </xsl:attribute> <xsl:attribute name="duration"> @@ -345,6 +350,7 @@ <xsl:call-template name="getFieldByIndex"> <xsl:with-param name="index" select="20"/> <xsl:with-param name="line" select="$line"/> + <xsl:with-param name="remaining" select="$remaining"/> </xsl:call-template> </xsl:variable> <xsl:if test="$notes != ''"> @@ -375,11 +381,13 @@ </xsl:if> </dive> + </xsl:if> </xsl:template> <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> @@ -387,12 +395,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> @@ -405,9 +415,14 @@ <xsl:value-of select="substring-before($line,'"$fs')"/> </xsl:when> <xsl:otherwise> - <xsl:if test="substring-after($line, '"$fs') = ''"> - <xsl:value-of select="substring-before(substring-after($line, '"'), '"')"/> - </xsl:if> + <xsl:choose> + <xsl:when test="substring-after(substring-after($line, '"'), '"') = ''"> + <xsl:value-of select="concat(substring-after($line, '"'), $lf, substring-before($remaining, '"'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(substring-after($line, '"'), '"')"/> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:when> |