The previous patch would not fill the first name field if there was
no second name. This rectifies that.

Signed-Off-By: Martin Long <[email protected]>
---
 xslt/uddf-export.xslt | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt
index 6468e89..9a03256 100644
--- a/xslt/uddf-export.xslt
+++ b/xslt/uddf-export.xslt
@@ -72,12 +72,21 @@
               <xsl:value-of select="."/>
             </xsl:attribute>
             <personal>
-              <first_name>
-                <xsl:value-of select="substring-before(., ' ')"/>
-              </first_name>
-              <last_name>
-                <xsl:value-of select="substring-after(., ' ')"/>
-              </last_name>
+              <xsl:choose>
+                <xsl:when test="contains(., ' ')">
+                  <first_name>
+                    <xsl:value-of select="substring-before(., ' ')"/>
+                  </first_name>
+                  <last_name>
+                    <xsl:value-of select="substring-after(., ' ')"/>
+                  </last_name>
+                </xsl:when>
+                <xsl:otherwise>
+                  <first_name>
+                    <xsl:value-of select="."/>
+                  </first_name>
+                </xsl:otherwise>
+              </xsl:choose>
             </personal>
           </buddy>
         </xsl:for-each>
-- 
1.9.1

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

Reply via email to