What are some ways to allow an RTF field to preserve empty tags?
One way I can think of is using XSLT formatting (Filtering XSLT tab in Formatting Features) on the specific field. Does anyone have other suggestions?
Thanks!
in this issue, Tridion converts <p></p> to <p/>, however HTML is not XML, so after my migration project, this is cause HTML error or JavaScript error for many cases, i added   (in HTML is ) <p> </p>, this will create a visible space to the HTML rendering. so continue to solve by adding <span style="display:none"> tag to hide the space...
i realize HTML is not equal to XML.
I bumped into this problem during a migration from R5 to 2011, and the way I solved it was by inserting a non breaking space inside the empty tags (turning <p/>
and <p></p>
to <p> </p>
, for instance), and changing every instance of
to  
.
However I was using a 3rd party tool that could do it "on the fly" during the migration, so I don't know how applicable it is in your case.
There is absolutely no need of such over-engineering (XSLT framework) or solutions which involves inclusion of unexpected characters (like non breaking space or p tags) as it may spoil the final HTML layouts depending on your HTML/CSS.
In SDL Tridion 2011, it is very simple to achieve indeed; follow below step:
1) On your CMS server, navigate to the following path: ..\TridionWeb\WebUI\Core\Controls\FormatArea\TcmXhtml
2) Open the configuration file named - TcmXHTML
3) In this configuration file locate the tag - new-empty-tags:
4) You may see few tags like command, source track etc. already there separated by a space.
5) Add all your tags which you want keep as empty tags separated by a space: For Example: If your tag entry looks like -
new-empty-tags: command source track
and apart from these you want preserve the following tags as empty - emptytag1, emptytag2 then update the tag entry as -
new-empty-tags: command source track emptytag1 emptytag2
6) Restart the SDL Tridion Content Manager DCOM+ Application and reload the CME
You will now be able to add and preserve tags like and
In addition, you can explore further and this configuration file can be used further to change the behaviour of your RTF fields
I am not sure you'll find a way to do this, since in XML a <tag/>
is equivalent to <tag></tag>
and the Tridion RTF is a XML field.
Many (most? all?) xml libraries will automatically convert "empty" tags to the closed form, and I believe Tridion will do this on save. The only solution I've seen so far seems to be to insert a non-breaking space.
An alternative solution would be to insert a character that you can potentially remove at publish time, but I didn't play around with this enough to tell you if it will work.