Can';t使用XSLT将rss提要以HTML形式显示在IE中
我已经创建了一个Can';t使用XSLT将rss提要以HTML形式显示在IE中,xslt,xslt-2.0,atom-feed,Xslt,Xslt 2.0,Atom Feed,我已经创建了一个.xsl文件来转换atom提要,以便在浏览器中友好地查看。在Chrome浏览器中查看时效果很好,但是IE(9.0.811)忽略了样式表 我的问题是:我能做些什么改变,让Internet Explorer像处理Chrome一样处理样式表 示例atom文件: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="/css/atom.xsl"?> <fee
.xsl
文件来转换atom提要,以便在浏览器中友好地查看。在Chrome浏览器中查看时效果很好,但是IE(9.0.811)忽略了样式表
我的问题是:我能做些什么改变,让Internet Explorer像处理Chrome一样处理样式表
示例atom文件:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/css/atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[A title here]]></title>
<subtitle><![CDATA[A CDATA description here.]]></subtitle>
<link href="http://www.site.com/channel" title="a title" rel="alternate" type="text/html" hreflang="en" />
<link href="http://www.site.com/channel/atom" rel="self" type="application/rss+xml" />
<id>http://www.site.com/channel</id>
<rights>All content © 2006-2013 Site Name unless otherwise noted. All rights reserved.</rights>
<updated>2011-12-18T20:34:31Z</updated>
<category term="Domain: Cat/Subcat" label="Heirarchy Label" />
<author>
<name>Editor's Desk</name>
<email>editors@site.com</email>
<uri>http://www.site.com/members/username</uri>
</author>
<logo>http://www.site.com/img/logo.gif</logo>
<entry>
<title><![CDATA[Some CDATA here]]></title>
<link href="http://www.site.com/channel/article-name" title="Article Name" rel="alternate" type="text/html" hreflang="en" />
<id>http://www.site.com/channel/article-name</id>
<content type="html"><![CDATA[<h3>New Post - Title</h3><p>A new post has been published titled "<a href="http://www.site.com/channel/article-name" title="Article Title">Article Title</a>".</p><p>Click the link above to go to the full biography and to view other user's ratings and comments.</p><p>Article posted in: <i>section -> subsection -> subcat</i>.</p>]]></content>
<author>
<name>Editor's Desk</name>
<email>editors@site.com</email>
<uri>http://www.site.com/members/username</uri>
</author>
<category term="Domain: Cat/Subcat" label="text label here" />
<rights>All content © 2006-2013 Site Name unless otherwise noted. All rights reserved.</rights>
<published>2011-12-18T20:34:31Z</published>
<updated>2011-12-18T20:34:31Z</updated>
</entry>
这可能是因为您的样式表是XSLT2.0,但Microsoft不支持它,因此IE也不支持它。我在XSLT示例中看不到任何需要XSLT2.0的内容,因此您可以尝试将样式表的版本设置为1.0而不是2.0
<xsl:stylesheet version="1.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
此外,您可能希望尝试将xsl:output元素的“version”属性更改为4.0,而不是1.0
<xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes" />
编辑:实际上,这可能是因为IE7.0及以上版本中的默认行为。进入工具->互联网选项->内容->设置(对于提要和Web片段),您将看到选项“打开提要阅读视图”。尝试取消勾选此项,然后重新启动IE,看看是否有效。感谢您的回复。我尝试了这两种方法,但它仍然在IE中被忽略。您在问题中提到它是XSLT的“摘录”。您确定您的完整XSLT不包含任何“仅XSLT 2.0”元素吗?实际上,我发现这可能是由于IE中的一个设置。我已经相应地编辑了我的答案。您好@Tim C,就是这样-xml或xsl表没有问题,但IE设置正如您所建议的。我对设置进行了更改,设置显示正确。我以前不知道这件事。
<xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes" />