如何使用自定义XSLT在浏览器中显示Atom/RSS提要? [英] How to display Atom/RSS feeds in browser with custom XSLT?

查看:61
本文介绍了如何使用自定义XSLT在浏览器中显示Atom/RSS提要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大约在2006年,我写了一个不错的XSLT,将我的RSS feed转换为自定义HTML.这样,如果用户从浏览器中单击,它将显示为简单页面,而不是一堆垃圾XML.如果在Feed阅读器中使用了相同的URL,则可以正确处理该URL,并且一切都很顺畅.

Back in about 2006, I wrote a nice XSLT that transformed my RSS feeds into custom HTML. That way if a user clicked from a browser it would display as a simple page rather than a bunch of junk XML. If that same URL was used in a feed reader it was handled properly and everything was slick.

如今,大多数浏览器(IE,Firefox,Safari,Opera)似乎都掌握了这些样式,并且不会放任自流.而且Chrome只是忽略了样式表的转换.

Now days, most browsers (IE, Firefox, Safari, Opera) seem to grab hold of the styles and won't let go. And Chrome just plain ignores the stylesheet transformation.

鉴于已经过去了几年,我只是忘记了一些细节吗?以前不是那么容易吗?

Given that it has been several years, am I simply forgetting some detail? Didn't it used to just be this easy?

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="/atom2html.xslt"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <!-- ... -->
</feed>

有人知道是否有一种方法可以用非常具体的提要样式想法来覆盖那些浏览器吗?有什么方法可以使Chrome变得更好吗?

Anyone know if there is a way to override those browsers with very specific ideas of feed styling? And is there any way to get something nice out of Chrome?

推荐答案

如果供稿响应的Content-Type设置为XML,而不是Atom,Chrome似乎仅应用XSLT处理指令.

Chrome appears to only apply the XSLT processing instruction if the Content-Type for the feed response is set to XML, not Atom.

这会在Chrome中显示XSLT:

This displays XSLT in Chrome:

Content-Type: application/xml

这不会显示任何样式(从技术上讲,这是更正确的类型):

This does not display any styling (which is technically the more correct type):

Content-Type: application/atom+xml

这篇关于如何使用自定义XSLT在浏览器中显示Atom/RSS提要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆