Name
MultiSelectDisplay
Notes
This template lets you display the values in a multiselect column "nicely", using a separator of your choosing. You pass it a multi-select column value and the separator character(s).
Example
This example would return the values in the States column with the ';' separator replaced by the vertical bar '|'.
<xsl:variable name="NiceDisplay">
<xsl:call-template name="MultiSelectDisplay">
<xsl:with-param name="MultiSelectValue" select="@States"/>
<xsl:with-param name="MultiSelectDelimiter" select="';'"/>
<xsl:with-param name="MultiSelectSeparator" select="'|'"/>
</xsl:call-template>
</xsl:variable>
Code
<xsl:template name="MultiSelectDisplay">
<xsl:param name="MultiSelectValue"/>
<xsl:param name="MultiSelectDelimiter"/>
<xsl:param name="MultiSelectSeparator"/>
<xsl:choose>
<xsl:when test="contains($MultiSelectValue, $MultiSelectDelimiter)">
<xsl:value-of select="concat(substring-before($MultiSelectValue, $MultiSelectDelimiter), $MultiSelectSeparator)" disable-output-escaping="yes"/>
<xsl:call-template name="MultiSelectDisplay">
<xsl:with-param name="MultiSelectValue" select="substring-after($MultiSelectValue, $MultiSelectDelimiter)"/>
<xsl:with-param name="MultiSelectDelimiter" select="$MultiSelectDelimiter"/>
<xsl:with-param name="MultiSelectSeparator" select="$MultiSelectSeparator"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$MultiSelectValue" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>