Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've got a multiline column in a list that contains HTML. When trying to use the field in SharePoint Designer 2010, it shows it as raw HTML, instead of rendering it. So using this syntax:

<xsl:value-of select="@MyColumn"/>

it produces this:

<div class="ExternalClass5F52DACEBDE7496CB9F6756AA44F91EA"><p>​</p> <table width="100%" class="ms-rteTable-default" cellspacing="0" style="font-size:1em"><tbody><tr class="ms-rteTableEvenRow-default"><td class="ms-rteTableEvenCol-default" rowspan="1" colspan="1" style="width:40%">​<strong>Sunday - Wednesday</strong></td> <td class="ms-rteTableOddCol-default" rowspan="1" colspan="1">​00:00 to 00:00</td></tr> <tr class="ms-rteTableOddRow-default"><td class="ms-rteTableEvenCol-default" rowspan="1" colspan="1" style="width:40%"><strong>​Thursday </strong></td> <td class="ms-rteTableOddCol-default">​​00:00 to 00:00</td></tr></tbody></table>   <p> </p></div>

I've read about using calculated columns and JavaScript to render HTML correctly. However, for ease of development, is there a best practice we can follow to not have this happen or to wrap the XML in Designer in an Unescape() function of some type? Thank you.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

There's an attribute you add to xsl:value-of called "disable-output-escaping".

So change your line to look like this:

 <xsl:value-of select="@MyColumn" disable-output-escaping="yes"/>
share|improve this answer
    
That was way too easy!! Thanks, James :) –  Alex C Jul 13 '11 at 7:49
    
Easy when you know how! :) –  James Love Jul 13 '11 at 8:54
    
Where should I add disable-output-escaping in a field? I don't have access to the underlying code of the form, but do have the ability to modify the fields. Is this an attribute I can add to a field to properly render the HTML returned from a multiline field? –  AurumPotabile Jan 10 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.