1

C# を使用して RSS フィードを解析しようとしていますが、XSLT で変換する必要があります。これが私の XSLT のスニペットです。

<xsl:output encoding="UTF-8" method="html" omit-xml-declaration="yes"/>
<xsl:template match="/">
    <xsl:apply-templates select="rss/channel/item" />
</xsl:template>
<xsl:template match="rss/channel/item">
    <item>
    <link><xsl:value-of select="normalize-space(./link)" /></link>
      </item>
</xsl:template>

ランダム RSS (the corriere della serra )を使用すると、これは XML Spy で正しくレンダリングされます。

<item>
<link>http://www.corriere.it/este(...)2aabc.shtml</link>
</item>
<item>
<link>http://www.corriere.it/cron(...)22a-11de-bb1e-00144f02aabc.shtml</link>
</item>
...

しかし、Microsoft .net ツールを使用すると (コードまたは Visual Studio XSLT デバッガーを使用して)、次のようになります。

<item>
<link>http://www.corriere.it(...)11de-aaa2-00144f02aabc.shtml
    </item>
    <item>
    <link>http://corrieredelmezzogiorno.corriere.it/le(...)03131900.shtml
        </item>
    <item>

</link>マークアップは一切出力されません。「リンク」を「XXX」に変更すると、これは完全に機能しますが、残念ながらこれはオプションではありません。

ここで何が起こっているのか?

4

1 に答える 1

1

不思議に思っている人のために、msxml はmethod="html"モード中にリンク タグを閉じません。最初の行を次のように変更すると

<xsl:output encoding="UTF-8" method="xml" omit-xml-declaration="yes"/>

上記のコードは完全に機能します...

于 2009-09-25T14:12:54.340 に答える