Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Templates: XSLT vs jQuery

I need a templating mechanism for html-pages bundled with my app. At first I looked at all the javascript templating solutions (like jQuery templates), but since my input data is XML, I suddenly remembered XSLT again. I came across tens of libaries, but none seemed to make use of XSLT, so I completely forgot about its existence, and how useful it is for creating templates.

So, is XSLT slowly deprecated and phased out by javascript alternatives? I read somewhere XSLT was too complicated for most users to work with, but is that its only downside or are there more cons?

Update: I can think of only one disadvantage myself: with XSLT the complete page has to be parsed/rendered before displaying anything to the user, and with the javascript the page is already visible and the missing elements are filled afterwards.

like image 595
Maestro Avatar asked Oct 04 '11 12:10

Maestro


1 Answers

XSLT is a modern XML transformation and functional programming language. The upcoming version 3.0 natively supports (together with XPath 3.0) higher-order functions, among other new features.

XSLT isn't "old" (few people know XSLT 2.0 or are aware that XSLT 3.0 is being worked on by the W3C XSLT WG).

XSLT in the browser had a recent big push forward by Saxon CE -- a trimmed down XSLT 2.0 processor that is compiled from Java to Javascript and is available client-side on the five major browsers. @Michael Kay even demoed XSLT 2.0 running client side on his iPhone...

like image 118
Dimitre Novatchev Avatar answered Oct 21 '22 16:10

Dimitre Novatchev