Howto: Convert a URL field into the two components of the URL (description and link)

When you create a field of type URL in SharePoint, users need to fill out two form fields: “Link” and “Description”. When the Data View Web Part requests this field value, it gets back the full String value as concatenated by SharePoint. In order to make any use out of this String at all, you need to break it apart. Here is how to do that.

First, browse out to your Links list (which you get by default when you create a SharePoint site), and add a new link and description.


1. Insert a Data View Web Part based on the links list
2. Drag the URL field into the Data View (depending on how you accomplished #1 above, this field may already be in your view and may already be formatted correctly, but just pretend it isn't for future reference)
3. Notice that the field value for your URL field says this:, Microsoft
4. So, what you want to do is select substrings of this string value.
5. For the Link part, you want to use this XSLT: <xsl:value-of select=“substring-before(@URL, ', ')“/>
6. For the Description part, you want to use this XSLT: <xsl:value-of select=“substring-after(@URL, ', ')“/>

Let me know if this makes sense.