这听起来像是一个应该提交给SDL客户支持的错误。行为与IE,Chrome和FF有什么不同?
除非支持可以提供热修复,否则我认为您唯一的选择是使用过滤XSLT过滤出唯一的BR(如Frank所示)。创建新的富文本字段时使用的默认XSLT过滤器包含此过滤,如下所示(最后一个<template>
节点)。
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<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(., ' ', '')) = '' 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(., ' ', '')) = '' 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>
您可以使用自定义XSLT过滤器或事件系统删除'
'。 –
@FrankvanPuffelen为什么'
'标签首先留在那里是有原因的吗?这看起来像一个错误。 –
您确定没有自定义XSLT吗?当然,也可以在XSLT中添加br标签。你可以尝试一个全新的富文本字段吗? – Quirijn