Mobile app version of vmapp.org
Login or Join
Pope3001725

: Paragraph tags in different browsers with SDL Tridion? In the SDL Tridion 2011 content management system, when editing a component in a rich text field (RTF) I noticed pressing enter results

@Pope3001725

Posted in: #Cms

In the SDL Tridion 2011 content management system, when editing a component in a rich text field (RTF) I noticed pressing enter results in different HTML tags in the source.

I think it's based on browser since I get <div> with Chrome. How do I make sure I get <p> tags in all browsers?

Update:
SDL Tridion 2011 SP1 has the following in the default XSLT schema rich text filter, which appears to fix the scenario of pressing enter when editing regular Body Text or paragraphs. I still have the issue when pressing enter after a heading, which comes out as a div in Chrome.

<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
<output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"></output>
<template match="/ | node() | @ *">
<copy>
<apply-templates select="node() | @ *"></apply-templates>
</copy>
</template>
<template match="*[ (self::br or self::p or self::div) and normalize-space(translate(., &apos; &apos;, &apos;&apos;)) = &apos;&apos; and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @ * or * or node()]) and not(following::node()[not( (self::text() or self::br or self::p or self::div) and normalize-space(translate(., &apos; &apos;, &apos;&apos;)) = &apos;&apos; and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @ * or * or node()]) )]) ]">
<!-- ignore all paragraphs and line-breaks at the end that have nothing but (non-breaking) spaces and line breaks -->
</template>
<template match="br[parent::div and not(preceding-sibling::node()) and not(following-sibling::node())]">
<!-- Chrome generates <div><br/></div>. Renders differently in different browsers. Replace it with a non-breaking space -->
<text> </text>
</template>
</stylesheet>


Updated question then is:

How do I make sure I get <p> tags in all browsers, even when pressing enter after a heading?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Pope3001725

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

We have exactly the same issue - this is based on specific browser behavior. I have found Fire Fox, IE and Chrome to all give different results. If memory serves well:


IE gives <p> tags
Fire Fox gives a double <br/>
Chrome uses a <div/> tag


I have a ticket filed with Customer Support about this, but as of now, I still don't have a solution. So we paste content into the field at the moment rather than actually editing in it otherwise it messes up our XHTML standards and our CSS does not work correctly.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme