Has anybody upgraded an old custom field type to use the new XSL transform in SharePoint 2010? I have a multi-column field type, and want the Display pattern to render the 2nd "column", which contains a hyperlink. My CAML render pattern looks like:

<RenderPattern Name="DisplayPattern">
         <Column />
      <Case Value="" />
         <HTML><![CDATA[<a href=']]></HTML>
         <Column SubColumnNumber="1" HTMLEncode="TRUE" />
         <Column SubColumnNumber="1" HTMLEncode="TRUE" />

In WSS 3.0, this would render the 2nd column in the field as a hyperlink in the LVWP, which is what I want. In SharePoint 2010, I tried adding TRUE to my field type definition, but that ends up rendering the actual anchor tag, as opposed to a clickable hyperlink:

<a href="http://www.something.com">www.something.com</a>

So then I tried creating a XSL transform, since that is supposed to be the new and improved way of doing this. Unfortunately, I can't get that to work either. I am getting the same thing I got using the RenderPattern. I'm no XSL expert, so can anyone confirm (or deny) that the following looks legitimate (or suggest a better way to do it)?

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">

  <xsl:template match="FieldRef[@FieldType='DataLinkUrl']" mode="Note_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:variable name="url">
      <xsl:value-of select="substring-before(substring-after(substring-after($thisNode/@*[name()=current()/@Name],';#'),';#'),';#')"/>
    <a href="{$url}"><xsl:value-of select="$url"/></a>


1 Answer 1


This link will help you to understand how mode attribute value is calculated.

  • 1
    Thanks, that was helpful in confirming what I already had for the "mode" attribute. In case anyone is interested in the future, I ended up using the ddwrt:HtmlDecode function to get my URL properly decoded: <xsl:variable name="link"> <xsl:value-of disable-output-escaping="yes" select="substring-after(ddwrt:HtmlDecode($thisNode/@*[name()=current()/@Name]),',')" /> </xsl:variable> <a href="{substring-before(substring-after($link,'href=&quot;'),', ')}">Link</a> Sep 20, 2010 at 16:04

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.