in a custom ListDefinition I used a calculated field to format a Text into an URL. I'm developping in VisualStudio2010 for SP2010.

Here is my ListDefinition:

      <Field Name="DocumentLink" StaticName="DocumentLink" DisplayName="Dokumentenlink" Type="Text"
  <Field Name="LinkType" StaticName="LinkType" DisplayName="Linktyp" Type="Choice" Format="RadioButtons"
         ID="D6A6880E-DF32-4A15-B5CC-1ABFA88EF2F4" >
  <Field Name="DocumentPath" StaticName="DocumentPath" DisplayName="DocumentPath" Type="Calculated"
         LCID="1031" ResultType="Text"
         ID="3957EA2D-5E88-477D-B801-27A51B5599C2" >
    <Formula>=IF(LinkType="Datei/Ordner", CONCATENATE("file:///", DocumentLink), DocumentLink)</Formula>
      <FieldRef Name="LinkType" />
      <FieldRef Name="DocumentLink" />

in my View the Field is displayed as Text, but in the DisplayForm it's (like i expect it) displayed as hyperlink.

My ViewFields are not complicated, so I would guess this isn't the failure

      <FieldRef Name="LinkTitle"></FieldRef>
      <FieldRef Name="DocumentPath" Format="Hyperlink" CreateURL="TRUE" TextOnly="FALSE" >
      <FieldRef Name="Describtion" ></FieldRef>

Tried solutions: -Adding a Computed Field with DisplayPattern. -Formula which calculates the FieldValue in HTML-tags (value) Alternative formula:

      CONCATENATE("&#60;DIV&#62;&#60;A href='file:///", DocumentLink, "' &#62;", DocumentLink, "&#60;/A&#62;&#60;/DIV&#62;"),
      CONCATENATE("&#60;DIV&#62;&#60;A href='", DocumentLink, "' &#62;", DocumentLink, "&#60;/A&#62;&#60;/DIV&#62;"))

Thanks for your help in advance.

  • How do you render your view?
    – Christophe
    Jul 25, 2012 at 5:24
  • Standard, in the View I changed only the FieldRefs.
    – Maikm88
    Jul 25, 2012 at 7:12

3 Answers 3


Thanks you for the suggestions. Here's the working solution: I had to create a xsl:stylesheet for the field. (The View stayed as before). The xsl I had to deploy in the sp-folder

"{SharePointRoot}\Template\LAYOUTS\XSL" My Template looks like this:

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
            exclude-result-prefixes="xsl msxsl ddwrt"
  <xsl:template match="FieldRef[@Name='DocumentPath']" mode="Text_body">
    <xsl:param name="thisNode" select="."/>
    <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
    <!--explicit link value-->
    <xsl:value-of select="$thisNode/@DocumentPath" disable-output-escaping="yes" />
    <xsl:text disable-output-escaping="yes">" &gt;</xsl:text>
    <!--short field value, without the file:/// text in case of file/dir-link-->
    <xsl:value-of select="$thisNode/@DocumentLink" disable-output-escaping="yes" />
    <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>

I hope someone else could make profit of this solution.


You could try to use the disable-output-escaping attribute in your XSLT.

You'll find some more explanations in this blog post:



If you want to avoid making XSL changes, you could try out my company's free HTML Calculated Column.

Here's my recent article on using it to create links that open in a new window:

Pentalogic: Opening a URL in a new Window from a SharePoint list

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.