Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty vs XSLT?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
mrequenes
Smarty n00b


Joined: 30 Apr 2003
Posts: 2

PostPosted: Wed Apr 30, 2003 2:25 pm    Post subject: Smarty vs XSLT? Reply with quote

Has anyone evaluated Smarty in comparison to XML-based solutions such as XSLT? If so, would you share your findings? Which did you choose for production? What were some of the factors that made one win over the other?

Thanks,

Max
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu May 01, 2003 3:06 am    Post subject: Reply with quote

Are you trolling or do you have some criteria that you are trying to hit? General questions like yours are difficult to answer to anyone's satisfaction Wink What are you trying to do, what are the constraints, what are the goals.

Simple Answer: Smarty Rocks, XSLT (cough cough).

Slightly less simple answer:

I have used both, extensively. I refuse to use XLST any longer (whenever other options are available) and I am actively converting applications that I still need to support away from XSLT (not always to Smarty, mind you).

First of all, XSLT is not nearly as standardized as people would have you believe. Every vendor using extensions. Not all parsers are compliant with the spec. If you are designing for client parsing: forget it. You'll never be able to trust your client to be able to parse your XSLT as even different versions of the same browser don't exhibit consistent results. Its a mess.

As far as "template" systems go, XSLT represent's probably the very worst possible of all systems that could be made into a standard. XSLT sits in no man's land. It is supposed to be for designers, but puts everything into a rigid framework completely UNSUITED for designers. Designers don't understand nodes or recursive algorithms. They don't care about trying to remember when and where template calls are made. XSLT insists that the flow of their lovely designs be chopped and mangled into nodes until the point that they can't recognize them anymore or understand what goes where.

Worse, you need a degree from the W3C to figure out how to do the simplest of things. THEN, you have to type until your fingers fall off because the syntax requirements are through the roof. ALL THIS without some of the familiar conveniences of "normal" programming languages. Its declarative (instead of procedural) syntax means you are going to be scratching your head every time you look at someone else's "template" or any time you have to modify your own work.

Your designers won't understand it (and will have minor heartattacks when you insist they use it because it is the new ms approved standard of the month) and your programmers will throw up (and have major heartattacks when you insist they use it because it is the new ms approved standard of the month).

The math situation is maybe worse in XSLT than Smarty and that says a lot.

But you get validating documents, even if no one really cares about that!

XSLT completely perverts the meaning of "template". XSLT is a declarative recursive node converter using XML's validating syntax and that's about it. In my opinion, the only good thing that came out of XSLT was XPATH and that's only important if you are going to jump on the XML bandwagon. I walked that road. I started converting all my work to be XML just after I read the original draft spec in 98. I tried. I tried HARD. I made things work, no matter the effort. I sweated but rejoiced because my documents were "standards compliant". Years later I can report that XML is a completely suitable language for computers to use to talk to each other or serialize data. BUT if that is *ALL* it is good for, then it has zero advantadges over binary data and many disadvantadges. Lets be honest, to say that humans can "read and understand" XML (and especially XSLT) is barely true. There is too much syntax to make it true.

XSLT was designed by a computer, not a human being. Actually, it was designed by a commitee of computers.

How did I do?
Back to top
View user's profile Send private message
dthought
Smarty Regular


Joined: 21 Apr 2003
Posts: 55
Location: Melbourne, Australia

PostPosted: Thu May 01, 2003 11:50 am    Post subject: Reply with quote

Being more immediately familiar with Smarty, I've lightly investigated XSLT, and got very, very scared. As a designer, it terrifies me.

Boots' post had me laughing, it's very poignant Very Happy
Back to top
View user's profile Send private message Visit poster's website
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Thu May 01, 2003 2:38 pm    Post subject: Reply with quote

XSLT is very powerful and has many many useful applications, but for web templating with PHP I still think Smarty is the best idea
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
mrequenes
Smarty n00b


Joined: 30 Apr 2003
Posts: 2

PostPosted: Thu May 01, 2003 4:32 pm    Post subject: Thanks all, for feedback Reply with quote

Esp. boots, for the detailed list of XSLT gotchas.

To answer boots' question, my post wasn't meant as a troll. I expected a little Smarty bias in responses (it IS a Smarty forum, after all), but that's ok.

I'm writing my own CMS/blog system after evaluating MANY (usually heavyweight, and usually sloppily coded) CMS systems. Requirements, in a nutshell, are:
* multi-page stories
* stories can branch off on multi-page "tangents"
* embedded images
* a teaser image (not a rigid topic-image) for the story
* ability to "publish" static pages as html files (easier for user to bookmark, better performance)
* user comments (in the future)

I am considering whether to use Smarty, XSLT, or a homemade templating solution.

Before getting your feedback, my opinions of the pros/cons of XSLT vs. Smarty were as follows:

XSLT
pros: it is a w3c standard
cons: complicated workflow, complicated syntax

Smarty
pros: nicer syntax, caching support, designed w/ CMS in mind
cons: yet another "non-standard" templating system, layout and logic intertwined (though, not much more than XSLT, AFAIK)

Thanks again for the comments. They were usefull.

- Max
Back to top
View user's profile Send private message Visit poster's website
mniskanen
Smarty Rookie


Joined: 26 Apr 2003
Posts: 20
Location: Lieksa,Finland

PostPosted: Fri May 02, 2003 8:54 am    Post subject: Re: Thanks all, for feedback Reply with quote

Just a couple of comments on your requirements
mrequenes wrote:
Esp. boots, for the detailed list of XSLT gotchas.
* multi-page stories
* stories can branch off on multi-page "tangents"
* embedded images
* a teaser image (not a rigid topic-image) for the story
* ability to "publish" static pages as html files (easier for user to bookmark, better performance)
* user comments (in the future)


Having written one publishing system and currently writing another (and
using Smarty, of course) I do not find any of these requirements too
tough. Multi-paging is a relatively simple task in most cases, embedded
images are not a problem, there is a technology for the production
of static pages if you wish. The same goes for the rest of the list. All this
requires some work, of course.

The very thing I like in Smarty is that it lets me develop my ugly, coarse
prototype templates, write the PHP code and then beg my fellow graphics
guru to make the site look good. We have now reached the point where
this separation truly works and works well!

Markku
Back to top
View user's profile Send private message
codemator
Smarty n00b


Joined: 20 Nov 2008
Posts: 1

PostPosted: Thu Nov 20, 2008 5:07 am    Post subject: See This Article Reply with quote

I am Using Smarty for last 88 months. In New project I want XSLT
See This Article
devpapers[dot]com[slash]article[slash]18
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP