by

Stripping out inline styles in RTF Fields in Tridion

Reading Time: < 1 minute

This issue came up recently with a client:

“This text has loads of inline styles. I didn’t think the RTF field would allow inline-styles.  How’d that happen, Frank ‽”

“Well, it’s copy-pasta; someone copied some text from somewhere and didn’t strip out the styling”

“Can we prevent that?”
Well, if you’re comfy with adding some XSLT to a schema, there’s a solution.

Plop this lil’ guy in there somewhere.

<xsl:template match="*"> 
  <xsl:copy> 
    <xsl:apply-templates select="@*[name(.)!='style']|*"/> 
  </xsl:copy>
</xsl:template>

Big thanks to Rick Pannekoek and John Askew for helping me figure this out.

1 Comment


  1. Be aware that this filter will strip underline, indent and inline images that also use style. As long as you don’t want underline, indented content or inline images you are ok.

Comments are closed.