Rei*_*Wit 6 xslt tridion tridion-2011
我在模式(Tridion 2011 SP1)中有一个richtext字段,附带了一个基本的XSLT过滤器(默认的XSLT或自定义的XSLT,对于这个问题无关紧要).
在IE9中,当我基于该模式创建组件时,Source选项卡中的XHTML被渲染得很好,没有任何名称空间,例如:
<p>a paragraph</p>
<p>
<a href="http://www.sdltridion.com">a link</a>
</p>
Run Code Online (Sandbox Code Playgroud)
我能够保存组件.
但是在Firefox(16.0.2,不支持)中,命名空间在"源"选项卡中呈现:
<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>
Run Code Online (Sandbox Code Playgroud)
这导致以下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'..
Now I know that it's an unsupported version of a Firefox, but where is this namespace coming from? The namespace defined in the Richtext XSLT is http://www.w3.org/1999/XSL/Transform...
And does anyone know of a possible workaround?
Here's the filtering XSLT, but as I already stated, it happens with the default XSLT too:
<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>
Run Code Online (Sandbox Code Playgroud)
我相信这个问题与这篇文章有关
Tridion 2011 - 在格式化功能窗口上过滤XSLT
看起来迁移过程(或者可能是奇怪的GUI行为)正在改变过滤XSLT,并且似乎会影响RTF字段的行为.基本上,在XSLT中使用命名空间和命名空间前缀的方式似乎已经改变.典型的XSLT使用xsl名称空间前缀,而新的XSLT似乎排除了前缀并使用默认名称空间.
我认为这是一个错误,应该提交给支持,但相关帖子中介绍了解决方法.