I have a list with two lookup columns. Each allow multiple selections. I will say right of the bat that I am limited by admins to only using the XSLT List View web part. The DataView Web part not available on the site.

The lookup column displays results as "one;two;three..." All on one line and without a space after the semi-colon. I found a solution online using the DataView web part but I cannot get it to work on the XSLT List View web part. https://deannaschneider.wordpress.com/2012/07/09/displaying-multiple-select-fields-one-per-row-in-a-dataview-web-part/

Anyone know who to get this working on the XSLT List View web part?

  • This is for SP2010? At what point are you experiencing problems? Mar 31, 2015 at 22:04

1 Answer 1


I had exactly the same problem and I solved it.

I hava a multi value Lookup Field named "g_x00fc_ltig_x0020_in_x0020__x0028_lang", where I want to display each selection in a new line instead of the default ";" separators.

You must substitute my field name by your field name.

I went into SharePoint Designer 2010 and opened my .aspx view. In the code I searched for the "xsl:template" tag (last line in my code snippet) and copied the following code just in front of the searched tag:

<xsl:template name="string-replace-all">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="by" />
    <xsl:when test="contains($text, $replace)">
        <xsl:value-of select="substring-before($text,$replace)" />
        <xsl:value-of select="$by" />
        <xsl:call-template name="string-replace-all">
        <xsl:with-param name="text" select="substring-after($text,$replace)" />
        <xsl:with-param name="replace" select="$replace" />
        <xsl:with-param name="by" select="$by" />
        <xsl:value-of select="$text" />

<xsl:template name="FieldRef_printTableCell_EcbAllowed.g_x00fc_ltig_x0020_in_x0020__x0028_lang_x0029_" match="FieldRef[@Name='g_x00fc_ltig_x0020_in_x0020__x0028_lang_x0029_']" mode="printTableCellEcbAllowed" ddwrt:dvt_mode="body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
    <xsl:param name="thisNode" select="."/>
    <xsl:param name="class" />
    <xsl:if test="@ClassInfo='Menu' or @ListItemMenu='TRUE'">
        <xsl:attribute name="height">100%</xsl:attribute>
        <xsl:attribute name="onmouseover">OnChildItem(this)</xsl:attribute>
    <xsl:attribute name="class">
        <xsl:call-template name="getTDClassValue">
            <xsl:with-param name="class" select="$class" />
            <xsl:with-param name="Type" select="@Type"/>
            <xsl:with-param name="ClassInfo" select="@ClassInfo"/>

    <xsl:variable name="thisRow">
        <xsl:call-template name="string-replace-all">
        <xsl:with-param name="text" select="$thisNode/@*[name()=current()/@Name]"/>
        <xsl:with-param name="replace" select="';'" />
        <xsl:with-param name="by" select="'&lt;br /&gt;'" />
    <xsl:value-of select="$thisRow" disable-output-escaping="yes"/>

The first template in the code is the given string-replace function from your reference.

The second template I have generated by formatting my column with a background color in SharePoint Designer and removed the "style" and "color" from the tag and additinally some other not needed code lines.

I added the code between and including the lines containing "thisRow".

Save it, and voila – it works.

Kind regards Ernst

  • I was missing the '&lt; and &gt;' around the br. Was using different coding to replace the < and >. Thanks!
    – Martin
    May 13, 2015 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.