Displaying ‘Person’ Columns with Presence in a Data View

27 Jan

(The title of this post could also be: "How to disable output escaping of the columns in your SharePoint Data View from SharePoint Designer")

You may have tried to use a list with a Person column as the source for a Data View.  You may have even had Presence information available in that column.

It's likely that all you got was a bunch of garbled HTML when you actually rendered the column.  This is because by default, the XSL transformation will escape all the HTML characters rendered for the "People" column type.  With a simple attribute in your XSL you can fix this, and show single and multiple Person entries correctly.

If you look in your code view in SharePoint Designer where the column is rendered, you'll see a simple value-of select like this:

<span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;@People&quot;</span> <span class="kwrd">/&gt;</span>

Simply modify that by adding an output escaping attribute:

<span class="kwrd">&lt;</span><span class="html">xsl:value-of</span> <span class="attr">select</span><span class="kwrd">=&quot;@People&quot;</span> <span class="attr">disable-output-escaping</span><span class="kwrd">=&quot;yes&quot;</span> <span class="kwrd">/&gt;</span>

And now it should render the column properly.  This will work for any data type that contains HTML.

Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *