Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a good idea to use XML and XSLT for websites?

Tags:

xml

xslt

I'm wondering whether it brings advantages or disadvantages when using a XML document for the content of a web page and XSLT to manage the display part and not using plain HTML.

The first condition in my eyes is browser support for XML and XSLT. But as far as I know no modern browser has a problem with it. (Correct me if I'm wrong.)

But are there for instance benefits (semantic web and so on) or losses (HTML tags are more common) in the ranking of search engines?

Or do you see other reasons why one should or should not use the combination of XML and XSLT for web pages?

Related:

Why choose an XSL-transformation?

Is there a point creating a site using XSLT

like image 464
okoman Avatar asked May 13 '09 07:05

okoman


3 Answers

Personally I wouldn't use clientside xslt very often; there are issues with browser support, and the fact that you may have data in the xml that you need to strip out (i.e. that the client doesn't need to know, or shouldn't know).

But serverside... back a few years, I used to routinely use this approach as an MVC implementation from VB6 - i.e. the VB6 code (the controller) gathers data as xml (the model), and uses xslt to shape the html (the view). It worked well in terms of separation of concerns. These days I would use ASP.NET MVC to do the same, but with ascx/aspx view templates.

like image 120
Marc Gravell Avatar answered Sep 22 '22 00:09

Marc Gravell


This is a VERY important topic. 10 years ago, people were beginning to ask this questions.....can we send data packets to browsers and have the browser render the content? The reason that design goal is so important is to address the problem we face today.....multiple types of devices and tablets that dont fully support the desktop model of browsing. XHTML has taken us so far.....now ECMAScripting is what people are trying to create to do such a thing. But its a very bad model in the long term. It breaks with the repurposing goal of markup and content on the web.

The answer is YES....you can build XSL/XSLT/XML types systems. You can send a packet of XML and with a link to its XSLT style sheet and have most if not all modern browsers parse the file into markup on the client. Ive done it and it works unbelievably fast.

Now the draw backs mentioned by the group are real ones. There are issues with how browsers parse the XSLT and then render say scripting elements and caching of stale XML, etc. There are real issues with interfacing with design teams, and learning to abstract content and design and structure into these types of pieces. But this is the real goal of the Web long term, and why XSL was designed the way it was. Its power is in separating out structure, data, and design, and freeing both the server and the client from the slavery of content locked into the design elements. Javascripted solutions, compiled and layered into the UI, has not helped but made it worse, because the markup design and data is often meshed together. I would encourage all new web developers to start considering an XSLT/XML solution because the end-goal is to be able to focus on XML data delivery to a whole host of clients BEYOND desktop browsers. If you have XSLT/CSS designed for a whole host of different devices, and XML is all thats sent beyond caching to your clients, you have a very simple, fast, and powerful repurposing data delivery system that goes beyond what the current desktop app/desktop browser-based web sites now give us, and usher in a truly expandable and powerful data delivery age for the Web. So, I say yes, give XSLT a try!

like image 42
Mitch Stokely Avatar answered Sep 20 '22 00:09

Mitch Stokely


Here is an example of an xsl based website.

http://www.skechers.com.

Enough said

like image 38
Jack Brown Avatar answered Sep 21 '22 00:09

Jack Brown