3

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.

1 Answer 1

6

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"/>
2
  • Easy when you know how! :)
    – James Love
    Jul 13, 2011 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? Jan 10, 2014 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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