public
Created

Split email addresses by delimiter and print values. Additionally insert BR element after 3th element

  • Download Gist
SplitEmailAddresses.xslt
XSLT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<xsl:template name="SplitEmailAddresses" ddwrt:ghost="">
<xsl:param name="emailAddresses" select="."/>
<xsl:param name="separator" select="';'"/>
<xsl:param name="counterEmail" select="1"/>
<xsl:if test="($counterEmail mod 4) = 0">
<br/>
</xsl:if>
<xsl:choose>
<xsl:when test="not(contains($emailAddresses, $separator))">
<xsl:value-of select="$emailAddresses" disable-output-escaping="yes" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($emailAddresses, $separator)" disable-output-escaping="yes"/>
<xsl:call-template name="SplitEmailAddresses">
<xsl:with-param name="emailAddresses" select="substring-after($emailAddresses, $separator)"/>
<xsl:with-param name="separator" select="';'"/>
<xsl:with-param name="counterEmail" select="$counterEmail+ 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.