Signed-off-by: Miika Turkia <[email protected]>
---
 xslt/manualcsv2xml.xslt | 46 +++++++++++++++++++++++++++++++++++++---------
 1 file changed, 37 insertions(+), 9 deletions(-)

diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index ac9d5c3..597b296 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -347,23 +347,51 @@
     <xsl:param name="line"/>
     <xsl:choose>
       <xsl:when test="$index > 0">
-        <xsl:call-template name="getFieldByIndex">
-          <xsl:with-param name="index" select="$index -1"/>
-          <xsl:with-param name="line" select="substring-after($line, $fs)"/>
-        </xsl:call-template>
+        <xsl:choose>
+          <xsl:when test="substring($line, 1, 1) = '&quot;'">
+            <xsl:call-template name="getFieldByIndex">
+              <xsl:with-param name="index" select="$index -1"/>
+              <xsl:with-param name="line" select="substring-after($line, 
$fs)"/>
+            </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:call-template>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:when>
       <xsl:otherwise>
         <xsl:choose>
-          <xsl:when test="substring-before($line,$fs) != ''">
-            <xsl:value-of select="substring-before($line,$fs)"/>
+          <xsl:when test="substring($line, 1, 1) = '&quot;'">
+            <xsl:choose>
+              <xsl:when test="substring-before($line,'&quot;$fs') != ''">
+                <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>
+              </xsl:otherwise>
+            </xsl:choose>
           </xsl:when>
+
           <xsl:otherwise>
-            <xsl:if test="substring-after($line, $fs) = ''">
-              <xsl:value-of select="$line"/>
-            </xsl:if>
+            <xsl:choose>
+              <xsl:when test="substring-before($line,$fs) != ''">
+                <xsl:value-of select="substring-before($line,$fs)"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:if test="substring-after($line, $fs) = ''">
+                  <xsl:value-of select="$line"/>
+                </xsl:if>
+              </xsl:otherwise>
+            </xsl:choose>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:otherwise>
     </xsl:choose>
+
   </xsl:template>
 </xsl:stylesheet>
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to