Skip to content

Commit

Permalink
Handle malformed EmailAddress (no mailto:).
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed Mar 16, 2005
1 parent b526b9c commit 06f23cc
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions build/v13_to_v12_sites.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,31 @@

<!--
Map Contact to ContactPerson
Cope with:
* absence of optional EmailAddress
* malformed EmailAddress (no mailto:)
* mixtures of GivenName and SurName
-->
<xsl:template match="md:ContactPerson">
<Contact Type="{@contactType}">
<xsl:if test="md:EmailAddress">
<xsl:attribute name="Email"><xsl:value-of select="substring-after(md:EmailAddress, 'mailto:')"/></xsl:attribute>
</xsl:if>
<!-- Email attribute -->
<xsl:choose>
<xsl:when test="starts-with(md:EmailAddress, 'mailto:')">
<xsl:attribute name="Email">
<xsl:value-of select="substring-after(md:EmailAddress, 'mailto:')"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="md:EmailAddress">
<xsl:attribute name="Email">
<xsl:value-of select="md:EmailAddress"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<!-- omit Email attribute if in doubt -->
</xsl:otherwise>
</xsl:choose>
<!-- Name attribute -->
<xsl:choose>
<xsl:when test="md:GivenName and md:SurName">
<xsl:attribute name="Name"><xsl:value-of select="concat(md:GivenName, ' ', md:SurName)"/></xsl:attribute>
Expand Down

0 comments on commit 06f23cc

Please sign in to comment.