0
我創建了.xsl
文件來轉換原子提要以便在瀏覽器中進行友好查看。在Chrome瀏覽器中查看效果很好,但IE(9.0.811)樣式表被忽略。無法通過XSLT獲取RSS源以HTML形式顯示爲HTML
我的問題是:我可以改變什麼,以便樣式表由Internet Explorer處理,就像使用Chrome一樣?
樣品原子文件:
<?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>[email protected]</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>[email protected]</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>
及相關摘自.xsl
文件:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.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 method="html" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
<xsl:value-of select="atom:feed/atom:title"/>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/css/style.css" />
</head>
<body>
<div id="container">
<xsl:variable name="feed-title">
<xsl:value-of select="atom:feed/atom:title" />
</xsl:variable>
<xsl:variable name="feed-uri">
<xsl:value-of select="atom:feed/atom:link[2]/@href" />
</xsl:variable>
<xsl:variable name="web-uri">
<xsl:value-of select="atom:feed/atom:link[1]/@href" />
</xsl:variable>
<h1>Atom Feed - <xsl:value-of select="atom:feed/atom:title" /></h1>
<p><xsl:value-of select="atom:feed/atom:subtitle" /></p>
<p><a href="{$feed-uri}"><img src="/img/i/atom-feed.png" alt="{$feed-title}" /></a> - <a href="{$feed-uri}"><xsl:value-of select="atom:feed/atom:title" /></a><br /><xsl:value-of select="feed/link[1]/@href" /></p>
<p>To subscribe to this RSS feed:</p>
<ul>
<li>Drag the orange RSS button or text link above into your news reader</li>
<li>Cut and paste this page's URL into your news reader</li>
</ul>
<p>Alternatively, you can <a title="{$feed-title}" href="{$web-uri}">view the actual online version</a> of this content.</p>
</div>
<div id="footer">
<xsl:value-of select="atom:feed/atom:rights" />
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
感謝您的回覆。我嘗試了這兩個,它仍然被忽略在IE瀏覽器。 – GWR 2013-03-17 17:10:13
你在你的問題中提到它是XSLT的'摘錄'。您確定您的完整XSLT不包含任何「僅限xslt 2.0」元素嗎? – 2013-03-17 17:39:46
其實,我發現它可能是由於在IE中的設置。我相應地編輯了我的答案。 – 2013-03-17 17:53:06