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">
<Switch>
<Expr>
<Column />
</Expr>
<Case Value="" />
<Default>
<HTML><![CDATA[<a href=']]></HTML>
<Column SubColumnNumber="1" HTMLEncode="TRUE" />
<HTML><![CDATA['>]]></HTML>
<Column SubColumnNumber="1" HTMLEncode="TRUE" />
<HTML><![CDATA[</a>]]></HTML>
</Default>
</Switch>
</RenderPattern>
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],';#'),';#'),';#')"/>
</xsl:variable>
<a href="{$url}"><xsl:value-of select="$url"/></a>
</xsl:template>
</xsl:stylesheet>