15 Mar

How to remove link for SharePoint lookup column from a DataView WebPart using XSLT

Whenever we use a lookup column into the dataview or listview, it displays a link to the lookup item it is referring to. This is the same behavior you see on the backend list views. But sometimes we just need to show data on page and do not need the link to the lookup item.

Setting disable-output-escaping="no" doesn’t work in this case, because then it displays the HTML coding for the link (‘a’ tag).

The easiest solution to get rid of ‘A’ tag is to remove it completely using sub-string function.

For example if you are showing a column named “Category”, in this case you can replace

<xsl:value-of select="@Category" disable-output-escaping="yes"/>

 

with

 

<xsl:value-of select="substring-before(substring-after(@Category, ‘&gt;’), ‘&lt;’)" disable-output-escaping="yes"/>

One Response to “How to remove link for SharePoint lookup column from a DataView WebPart using XSLT”

  1. 1
    The most perfect WORKFLOW Approval Sharepoint Designer Base Says:

    The most perfect WORKFLOW Approval Sharepoint Designer Base…

    Code For Future » Blog Archive » How to remove link for SharePoint lookup column from a DataView WebPart using XSLT – By Jayvardhan Patil…