I am using multi item lookup fields in a list (eg: "Data Subjects"). I then have a web part page with a Data View Web part connected to this list.

The data within Lookup fields span the column width but I wish each new item of data to start on a new line for clarity.


Apples; Pears; Peaches;

I am trying to insert the following XSL into code view:

<xsl:param name="text" select="@Data_x0020_Subjects"/>  
<xsl:when test="contains($text, ';')">
<xsl:value-of select="substring-after($text, ';')"/>
<xsl:value-of select="concat(.,'&#xA;')"/>
</xsl param>

However, I get various errors relating to the location of the XSL: or "keyword xsl:stylesheet may not contain xsl:choose"

Newbie to XSL so any help would be much appreciated!


At first glance, you are closing off your xsl param in the first line. Then you have an unnecessary and mistyped closing xsl param tag which can be removed. You'll also want to include an xsl:otherwise so that if no multiple selection is made, the text is returned.

This might be helpful, look at question 1. You'll need to do a recursive template to do it, it isn't as easy as doing a string replace, you have to break the components up and interject some html into the output.

Using the above link, and this one, I was able to get it working as a sample. This is the template to add with all the other templates defined in the XSL.

<xsl:template name="StringSplit">
<xsl:param name="val" />
  <xsl:when test="contains($val, ';')">
   <xsl:value-of select="substring-before($val, ';')" />
    <br />
     <xsl:call-template name="StringSplit">
     <xsl:with-param name="val" select="substring-after($val, ';')" />
      <xsl:value-of select="$val" />

Then in your rowview, you'd call this template as such:

<td class="ms-vb">
    <xsl:call-template name="StringSplit">
      <xsl:with-param name="val" select="@YourColumn" />
  • Hi Eric, thanks for your help. I have tried the following revised xsl with no luck <xsl:param name="text" select="@Data_x0020_Subjects"/> <xsl:choose> <xsl:when test="contains($text, ';')"> <xsl:value-of select="substring-after($text, ';')"/> <xsl:value-of select="concat(.,'&#xA;')"/> <xsl:otherwise></xsl:otherwise> </xsl:when> </xsl:choose> the place i thought would be most suitable is between an <xsl template> and closing </xsl template> tags. I am getting "Failed setting processor stylesheet: 0x80004005 : keyword xsl:param may not be used here" – Stephen May 25 '11 at 11:01
  • Without seeing your full xslt, it will be difficult to debug. You'll need to utilize a template like I had linked in order to break apart the multiple values. You'd also want to include <xsl:value-of select="$text" /> within your otherwise markup so that singular items will be displayed. – Eric Alexander May 25 '11 at 12:29
  • Edited answer with the solution. – Eric Alexander May 26 '11 at 13:50
  • nice post..... thanx.. i am facing filter problem with multivalue parameters..any suggestions? – user4284 Aug 8 '11 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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