Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any big sites using Client Side XSLT?

Tags:

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.

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?

Thanks Internet, Zach

like image 975
zachleat Avatar asked Nov 08 '08 03:11

zachleat


People also ask

Does anyone use XSLT anymore?

XSLT is very widely used. As far as we can judge from metrics like the number of StackOverflow questions, it is in the top 30 programming languages, which probably makes it the top data-model-specific programming language after SQL. But XSLT isn't widely used client-side, that is, in the browser.

Why XSLT is important for XML?

XSLT enables you to transform an XML document into another markup language. The most common use of XSLT is to transform information to HTML for display on the Web. But XSLT can also be used to convert information from XML into markup for wireless display, for transmission to PDAs and web-enabled cell phones.


2 Answers

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.

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.

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.

like image 118
Buddy Avatar answered Sep 27 '22 19:09

Buddy


I couldn't tell you in detail how it's implemented, but World of Warcraft is pretty big and high traffic, and their web site is implemented as you describe.

like image 42
Joel Mueller Avatar answered Sep 27 '22 19:09

Joel Mueller