[PATCH 1/2] Support buddies with only a first name, no surname.
Martin Long
martin at longhome.co.uk
Wed Dec 10 13:30:31 PST 2014
The previous patch would not fill the first name field if there was
no second name. This rectifies that.
Signed-Off-By: Martin Long <martin at longhome.co.uk>
---
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
More information about the subsurface
mailing list