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

We use default Tridion XSLT for RTF field.
This field should take any html text and save it as is. However, some fields are taken out after XSLT transformation.
For example:

input:

  <!--[if gt IE 8]><!--> <html class="loading no-js" /> <!--<![endif]-->
  <link rel="stylesheet" href="main.min.css" /> 
  <div id="loader-wrapper">
     <div id="loader"></div>
  </div>

output:

  <!--[if gt IE 8]><!--><!--<![endif]-->
  <div id="loader-wrapper">
     <div id="loader"/>
  </div>

For some reason html and link tags dissapear. Could someone give advice how to resolve this issue?

share|improve this question

2 Answers 2

The Tridion RTF XSLT formats HTML to XHTML, therefore updating the empty <div> tag to be a self closing tag.

See questions like http://stackoverflow.com/questions/10537656/creating-anchor-links-in-rich-text-fields-with-sdl-tridion-2011-sp1 for examples of how to resolve this using an embedded span tag

You will need something like

<template match="div[(@id = 'loader')]">
    <copy>
        <xhtml:span xmlns:xhtml="http://www.w3.org/1999/xhtml" class="hidden"> </xhtml:span>
    </copy>
</template>

To allow HTML 5 and other non-standard tags you will have to extend TcmXhtml.Config as per

http://stackoverflow.com/questions/15263064/html5-tags-are-not-working-in-rtf-field-for-tridion-2011

share|improve this answer
    
Unfortunately, this approach doesn't work for me. I added new-inline-tags: link and new-blocklevel-tags: link into config file, restart "SDL Tridion Content Manager" COM+ and IIS. But without luck –  Vitaliy Aug 20 at 13:10
    
looks like link is reserved somewhere, because new-inline-tags: newtag allows newtag to be present in RTF –  Vitaliy Aug 20 at 14:18

This is not caused by the XSLT, but rather by Tidy, which is also executed when an RTF is updated. The RTF content is wrapped in a <body/> tag before processing, so Tidy will remove anything that doesn't belong in the body of an html page. In your case, html and link elements don't belong in the body, so they are stripped.

That only leaves the question of why you are using a RTF field for this kind of data. RTF fields are intended for allowing content editors to update content. To use them for technical parts of your html page is probably not a good idea anyway.

share|improve this answer
    
I'd rather use text field than RTF, but client wants to have some quick preview for that html in Tridion. We don't use Tridion in classical way and this field made for importing some static html part with javascript and css into external service. –  Vitaliy Aug 20 at 13:08

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.