我在模式(Tridion 2011 SP1)中有一个富文本字段,附加了一个基本的 XSLT 过滤器(默认 XSLT 或自定义过滤器,对于这个问题无关紧要)。
在 IE9 中,当我基于该架构创建组件时,源选项卡中的 XHTML 呈现良好,没有任何命名空间,例如:
<p>a paragraph</p>
<p>
<a href="http://www.sdltridion.com">a link</a>
</p>
我能够保存组件。
但是在 Firefox(16.0.2,不支持)中,在 Source 选项卡中呈现了一个命名空间:
<p xmlns="http://www.w3.org/1999/XSL/Transform">a paragraph</p>
<p xmlns="http://www.w3.org/1999/XSL/Transform">
<a href="http://www.sdltridion.com">a link</a>
</p>
这会导致以下 XML 验证错误:
The element 'Paragraph' in namespace 'http://www.yme.com/GeneralContent' has invalid child element 'p' in namespace 'http://www.w3.org/1999/XSL/Transform'. List of possible elements expected: any element in namespace 'http://www.w3.org/1999/xhtml'..
现在我知道它是一个不受支持的 Firefox 版本,但是这个命名空间来自哪里? Richtext XSLT 中定义的命名空间是
http://www.w3.org/1999/XSL/Transform
...有没有人知道可能的解决方法?
这是过滤 XSLT,但正如我已经说过的,默认 XSLT 也会发生这种情况:
<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()]))])]">
</template>
<template match="br[parent::div and not(preceding-sibling::node()) and not(following-sibling::node())]">
<text></text>
</template>
<template match="table|td|tr|th|tbody|p|div|a">
<element name="{name()}">
<choose>
<when test="name() ='img'">
<for-each select="@*">
<attribute name="{name()}">
<value-of select="."></value-of>
</attribute>
</for-each>
</when>
<otherwise>
<for-each select="@*">
<choose>
<when test="name() ='border'"></when>
<when test="name() ='cellpadding'"></when>
<when test="name() ='cellspacing'"></when>
<when test="name() ='bgcolor'"></when>
<when test="name() ='bordercolor'"></when>
<when test="name() ='width'"></when>
<when test="name() ='height'"></when>
<when test="name() ='bordercolor'"></when>
<when test="name() ='span'"></when>
<when test="name() ='style'"></when>
<when test="name() ='class'">
<choose>
<when test=". ='MsoNormal'"></when>
<otherwise>
<attribute name="{name()}">
<value-of select="."></value-of>
</attribute>
</otherwise>
</choose>
</when>
<otherwise>
<attribute name="{name()}">
<value-of select="."></value-of>
</attribute>
</otherwise>
</choose>
</for-each>
</otherwise>
</choose>
<apply-templates></apply-templates>
</element>
</template>
<template match="h1">
<element name="h2">
<apply-templates></apply-templates>
</element>
</template>
<template match="td/p">
<apply-templates></apply-templates>
</template>
<template match="li/p">
<apply-templates></apply-templates>
</template>
<template match="link|script|font|iframe|ilayer|layer|span|small">
<apply-templates></apply-templates>
</template>
</stylesheet>
最佳答案
我相信这个问题与这篇文章有关
Tridion 2011 - Filtering XSLT on Formatting Feature window
似乎迁移过程(或者可能是奇怪的 GUI 行为)正在改变过滤 XSLT,并且似乎影响了 RTF 字段的行为。基本上命名空间和命名空间前缀在 XSLT 中的使用方式似乎已经改变。典型的 XSLT 使用 xsl
命名空间前缀,而您的新 XSLT 似乎排除了前缀并使用默认命名空间。
我认为这是一个错误,应该提交给支持,但相关帖子中介绍了解决方法。
关于xslt - 浏览器不受支持的 Tridion 2011 SP1 富文本 XSLT 中的命名空间问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13362450/