Opinion Needed: Templating Engines vs XML / XSL Output


     I'm interested in getting some suggestions.  Right now I'm developing an architecture which does the presentation layer using templeting.  Now, my question / advice needed:  Right now I'm doing XML / XSL translation.  Part of the reason is I like the speed of using PHP's built in DOM framework, plus the output doesn't have to be HTML, I can output to whatever format I want.   However, I'm thinking of using Smarty due to its ease of use and mostly because my architecture is for the Web.  The only thing stopping me is I've heard (never fully investigated) Smarty is slow.

     My questions:  Do I stay w/ XML / XSL, move onto Smarty, or try another templeting engine.  Please give some opinons, I would really appreciate.
Who is Participating?
RurneConnect With a Mentor Commented:
Stay with XSL/XML+CSS.  Smarty has similar-ish syntax to PHP, so there's no need to introduce the Smarty interpreter when you can do the same thing with proper design and native PHP.  Really, the same argument can be made for most, if not all, Web-based templating engines.

I say XSL because you can use different transforms for different media; you don't have that flexibility with the others.  While basic Web surfing might be the bulk of your userbase, you might find yourself needing to implement for the mobile-browser market, or implementing RSS/Atom newsfeeds, or providing lightweight or alternate formats for accessibility utilities like screen readers.

Really, if you don't need that degree of flexibility, then use good design principles and native PHP.  You gain nothing from a dumbed-down syntax that requires an interpreter to be compiled at run-time per page rendering.


If you ask me: things that make page slow are frames and too many (and) big pictures...

So if you use a CSS powered template wisely it should be pretty fast.

But as always - you will need to try it and see it for yourself.

XML+XSL will run only on browsers that support them. Nowadays browsers support them but if you plan to output for palmtops, mobiles etc my vote is towards templates.

Another advantage of templates is that they give you the freedom to create code for forming the layout. Plain XML only outputs information and sometimes this is not enough.
I would implement a solution like this article talks about.  Most template engines add a lot of overhead for little benefit.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.