6

スキーマ(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、サポートされていません)では、名前空間は[ソース]タブに表示されます。

<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検証エラーが発生します。

名前空間'http://www.yme.com/GeneralContent'の要素'Paragraph'には、名前空間'http://www.w3.org/1999/XSL/Transform'の無効な子要素'p'があります。予想される可能な要素のリスト:名前空間'http://www.w3.org/1999/xhtml'の任意の要素。

これはサポートされていないバージョンのFirefoxであることがわかりましたが、この名前空間はどこから来ているのでしょうか。リッチテキスト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(., &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()]))])]">
    </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() =&apos;img&apos;">
                    <for-each select="@*">
                        <attribute name="{name()}">
                            <value-of select="."></value-of>
                        </attribute>
                    </for-each>
                </when>
                <otherwise>
                    <for-each select="@*">
                        <choose>
                            <when test="name() =&apos;border&apos;"></when>
                            <when test="name() =&apos;cellpadding&apos;"></when>
                            <when test="name() =&apos;cellspacing&apos;"></when>
                            <when test="name() =&apos;bgcolor&apos;"></when>
                            <when test="name() =&apos;bordercolor&apos;"></when>
                            <when test="name() =&apos;width&apos;"></when>
                            <when test="name() =&apos;height&apos;"></when>
                            <when test="name() =&apos;bordercolor&apos;"></when>
                            <when test="name() =&apos;span&apos;"></when>
                            <when test="name() =&apos;style&apos;"></when>
                            <when test="name() =&apos;class&apos;">
                                <choose>
                                    <when test=". =&apos;MsoNormal&apos;"></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>
4

2 に答える 2

6

この問題はこの投稿に関連していると思います

Tridion2011-フォーマット機能ウィンドウでのXSLTのフィルタリング

移行プロセス(またはおそらく奇妙なGUIの動作)がフィルタリングXSLTを変更しているようであり、RTFフィールドの動作に影響を与えているようです。基本的に、XSLTでの名前空間と名前空間プレフィックスの使用方法が変更されたようです。通常のXSLTはxsl名前空間プレフィックスを使用しますが、新しいXSLTはプレフィックスを除外し、デフォルトの名前空間を使用しているようです。

これはバグであり、サポートに提出する必要があると思いますが、回避策は関連する投稿で説明されています。

于 2012-11-13T15:15:57.677 に答える
3

あなたのスタイルシートは<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">、入力(など)要素を受け取り、それらを同じ名前(たとえば)の要素に変換しますが、XSLT名前空間にあること<element name="{name()}">を意味します。<template match="table|td|tr|th|tbody|p|div|a">ptablep

したがって、代わりにおそらく必要なのは、XSLT名前空間が作成する結果要素に干渉しないようにプレフィックス(つまり<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">および)を付けてXSLTコードを記述することです。<xsl:template match="table|td|tr|th|tbody|p|div|a">

一方、に置き換える ことも同様<element name="{name()}">に行う必要があります。<xsl:copy>

于 2012-11-13T15:19:36.340 に答える