任何使用客户端 XSLT 的大网站? [英] Any big sites using Client Side XSLT?

查看:30
本文介绍了任何使用客户端 XSLT 的大网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我一直在思考在服务器端构建原始 XML 的非主流架构,然后在客户端使用 XSLT 样式表将 XML 转换为完整的 UI.当然,如果客户端不支持客户端 XSLT,则必须存在一种回退机制,在这种情况下,我们只需在服务器端为它们进行转换.

Lately, I've been pondering the somewhat non-mainstream architecture of building raw XML on the server side, and then using an XSLT stylesheet on the client to transform the XML into the full UI. Of course, a fallback mechanism would have to exist if the client was not capable of client side XSLT, in which case we'd just transform it for them on the server side.

我对 XSLT 已经非常熟悉了,这种方法似乎是一种清晰的表示和内容分离,完全将数据强制转换为 XML,并使用 XSLT 进行表示.

I'm already intimately familiar with XSLT, and this approach seems to be a clean separation of presentation and content, completely forcing the data into XML, and using XSLT for presentation.

我也知道这确实给应用程序增加了一层额外的复杂性,这只是另一个可能失败的移动部分.

I'm also aware that this does add an extra layer of complexity to the application, which is just another moving part that can fail.

我的问题是:是否有任何大牌或大流量网站使用这种方法,如果有:您从中吸取了哪些限制/经验教训?

My question is: are there any big name or big traffic sites using this approach, and if so: what limitations/lessons learned did you take away from it?

感谢互联网,扎克

推荐答案

就像其他人提到的,暴雪有很多网站是客户端 xsl.我建议避免使用客户端 xsl.这是一个非常酷的想法,但是您需要解决许多不寻常的错误.

Like other people have mentioned, Blizzard has many sites that are client side xsl. I would recommend avoiding client side xsl. It is a really cool idea, but there are many unusual bugs that you need to work around.

在 Firefox 中,任何使用 document.write 的 javascript 都会破坏 DOM.此外,firefox 的 noscript 插件会停止客户端 xsl.在这两种情况下,用户都看不到任何东西.似乎没有办法检测到这种错误,所以回退是行不通的.

In Firefox, any javascript that uses document.write will destroy the DOM. Also, the noscript plug-in for firefox stops client side xsl. In both cases, the user will see nothing. There doesn't seem to be a way to detect this kind of error, so a fall back will not work.

在 IE 中,如果您有任何 30 倍重定向到不同来源的东西(从 http 到 https 或跨子域),您将收到违反 同源政策.你并没有真正违反同源政策,但 IE 的行为就像你一样.例如,如果您访问 http://foo.example.com/login 并执行 302重定向到 https://bar.example.com/login.xml,IE 会处理 xsl就好像它来自 bar.example.com 一样,它会将 xml 视为来自 foo.example.com.因此,您需要为重定向恢复元刷新等内容.

In IE, if you have anything that does a 30x redirect to something of a different origin (going from http to https or crossing sub domains), you will get an error for violating the same origin policy. You did not really violate the same origin policy, but IE acts like you did. For example, if you go to http://foo.example.com/login and that does a 302 redirect to https://bar.example.com/login.xml, IE will treat the xsl as if it came from bar.example.com and it will treat the xml as if it came from foo.example.com. So you will need to revert to something like a meta refresh for your redirects.

这些都是我不经意间想到的.这是个好主意,但请注意这些问题.

These are the things that I came up with off the top of my head. It is a neat idea, but be aware of these issues.

这篇关于任何使用客户端 XSLT 的大网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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