Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding self closing tags in RTF field

We did an upgrade from Tridion 5.3 to Tridion 2011 SP1.

In our existing content at so many place in RTF field we are using html element like <a name="top" id="top"></a>. When we publish component/page from tridion anchors <a> tags are getting converted to self closing anchor tags <a name="top" id="top" />. Because of this hyperlink is getting formed on entire content of RTF field, as browser is treating this tag a start tag of anchor <a>. When we check page source in FireFox it says "Self-closing syntax ("/>")" used on non-void HTML element. Ignoring the slashes and treating as a start tag. To fix this we update the existing content to <a name="top" id="top">&nbsp;</a> it is working fine but not a good solution. Any other ideas/configuration, so that it will not be converted to self closing tags.

like image 374
user1453602 Avatar asked Oct 18 '12 12:10

user1453602


1 Answers

I have a similar question about this here

I have posted my work around there. Hope it helps.

I am not sure what kind of templates you are using, but generally I post process my output and look for any empty tags using an XSLT and the XSLT Mediator. When I find empty tags I tend to convert them to contain empty text to prvent any issues in the browsers viewing the final content.

<div></div> or <div/>

will get converted to

<div> </div>

Whilst the first examples are technically valid XML, they do (as you have discovered) break several browsers.

like image 56
Chris Summers Avatar answered Sep 27 '22 01:09

Chris Summers