0

I have a list, with several fields, including a Lookup field. I display the items of the list on a custom webpart. Everything works fine. When I click on an item in the web part, the default DispForm is displayed with all the fields with values. The lookup field is displayed as a link to the original item to another list, ie there is a link I can click, but I do not want the end user can do this. I don't want to display the lookup value as link?

How it can be done?

  • Have you managed to solve this or do you still need help? – Christoffer Mar 5 '15 at 15:55
1

You can use substrings to extract and display the text of the hyperlink:

<_remove_ xsl:variable name="overallstatussegment">
    <xsl:value-of select="substring-after(@OverallStatus, '&gt;')" />
<_remove_/xsl:variable>
<_remove_xsl:value-of select="substring-before($overallstatussegment, '&lt;')" />
0

The accepted answer led me in the right direction but I had to clean up the XSL code a bit and added a few more substrings to get this to work for me (SP 2010):

<xsl:variable name="DivisionUrl">
    <xsl:value-of select="substring-after(@Division,'&quot;&gt;')"/>
</xsl:variable>
<xsl:value-of select="substring-before($DivisionUrl,'&lt;/a&gt;')"/>

Display form entire table row example:

 <tr>
  <td width="190px" valign="top" class="ms-formlabel">
   <H3 class="ms-standardheader">
    <nobr>Division</nobr>
   </H3>
  </td>
  <td width="400px" valign="top" class="ms-formbody">
   <xsl:variable name="DivisionUrl">
        <xsl:value-of select="substring-after(@Division,'&quot;&gt;')"/>
   </xsl:variable>
    <xsl:value-of select="substring-before($DivisionUrl,'&lt;/a&gt;')"/>       
  </td>
 </tr>

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.