Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use HTML markup in languages like ruby, php, asp.net mvc instead of XLST to convert XML to HTML?

Tags:

html

xml

I just learned about XLST on stackoverflow today (I love how in computers you can program for years and constantly have 'darn, how did I not know about that technology' moments). I'm wondering how popular XLST it is for web development? I've worked on a few websites (using php, ruby, and asp.net mvc) but I'm not a web developer by any means.

Is the reason each web language I listed above has it's own way of marking up html (and thus taking advantage of 'templates') just to make it simpler (simpler as in more to the point and not and more geared to one specific purpose) in that you don't have to first convert what you want to display to xml and then to html? Or are there other reasons why XLST doesn't seem too popular for web development? Or am I just crazy (again most of my work is with Desktop apps) and actually it is widely used in webpages? If not in development, what do you mainly use it for?

It seems that being able to easily serialize objects in xml with C# would make XLST a very popular way of displaying object in HTML on websites?

Thanks for feeding my curiosity!!

like image 968
Evan Avatar asked Aug 09 '10 01:08

Evan


1 Answers

IMHO there are two main reasons why XSLT is not very popular:

  • it's generally hard.
  • you can just skip it and directly write HTML, and HTML is not hard and has first-class support from all web frameworks.

In summary, there is usually not enough reason to introduce yet-another-abstraction. Abstractions are not free, they solve some problems but introduce others (i.e. the "solve it by adding another layer of indirection" adagio), so the benefits must clearly outweight the costs.

That said, there are XSLT-based solutions for many web frameworks, e.g.:

  • ASP.NET MVC XSLT view engine
  • libxslt in RoR

Here's an excellent article that discusses XSLT for view engines.

like image 134
Mauricio Scheffer Avatar answered Sep 24 '22 01:09

Mauricio Scheffer