Page 1 of 1

Transform View without XSLT

Posted: Thu Dec 08, 2005 2:54 pm
by Ambush Commander
How would one go about implementing a Transform View without XSLT?

Re: Transform View without XSLT

Posted: Thu Dec 08, 2005 11:51 pm
by n00b Saibot
MVC :?

Re: Transform View without XSLT

Posted: Fri Dec 09, 2005 7:45 am
by Buddha443556
Ambush Commander wrote:How would one go about implementing a Transform View without XSLT?
You would write routines to transform each piece of data which is one of the reasons to use XSLT. It's much easier to change XSLT includes than a bunch of renderX routines.

According to PoEAA the choice comes down to whether your using server pages (ie. PHP) or XSLT in programming.
On the view front the choice between Template View and Transform View depends on whether your team uses server pages or XSLT in programming. Template Views have the edge at the moment, although I rather like the added testability of Transform View. If you have the need to display a common site with multiple looks and feels, you should consider Two Step View.

Posted: Fri Dec 09, 2005 9:22 am
by Ambush Commander
Okay, now seems to be a prime place to start using XSLT.

There appear to be compatibility problems for XSLT (not being default install, versions for 4 and 5).

Is it really worth the trouble of using XSLT and then having to get bent out of shape making it work on PHP4 and PHP5? And what about hosts that don't have the extension installed. Basically, for software you want to distribute, is the power of XSLT worth the thorny cross-PHP issues? Is it worth making your templating dependant on XSLT (I'm starting to not favor Smarty...)

Actually, the way I'm going about it is a bunch of renderX() routines. Actually, I call them paintX() routines, but same thing.

Posted: Fri Dec 09, 2005 12:17 pm
by Buddha443556
Ambush Commander wrote:There appear to be compatibility problems for XSLT (not being default install, versions for 4 and 5).

Is it really worth the trouble of using XSLT and then having to get bent out of shape making it work on PHP4 and PHP5? And what about hosts that don't have the extension installed. Basically, for software you want to distribute, is the power of XSLT worth the thorny cross-PHP issues? Is it worth making your templating dependant on XSLT (I'm starting to not favor Smarty...)
I often fork my projects to try out such ideas to see them in action. I usually learn something from such endeavor. Sometimes the lessons learned are even rolled back into the main branch and sometime I'm just glad I work alone so no one is around to say, "I told you so!" :oops:

As you pointed out some customers may have more problems getting XSLT working than others. That's usually something I try to avoid.

Posted: Mon Dec 12, 2005 10:38 am
by Maugrim_The_Reaper
'Fraid I run from XSLT. The is it/is it not installed question raises too many opportunities for a deluge of concerned users to invade my forums ;)

I'm currently using Savant rather than Smarty. Smarty is pretty, but I never quite understood its use of a sub-language. Maybe what you need is one of those "forks" mentioned by Buddha443556. If your app can switch between template engines (or use a Facade to standardise the API) you can test a few alternatives before racing at XSLT.

I think non-standard extensions are an absolute pain in the ass to be honest. When you distribute applications its rarely that you can rely on them to be widely available for everyone... Over the last year I've almost given up and just searched for non-extension based alternatives where they were absolutely required.

Posted: Mon Dec 12, 2005 12:02 pm
by GRemm
You could also use the patXmlRenderer ( http://php-tools.de/ ) to take xml and render out whatever you would like. I haven't used it myself but from the docs / examples (their whole site) it looks as if it acts as a view transformation layer for xml documents.

This gets rid of the xslt dependencies while allowing you much the same effect. The drawback is the lack of xslt templating which I absolutely love syntax-wise.

I have deployed close to 20 xslt projects in the last year and half and only found two servers that didn't have the proper extensions loaded. 10% is too high a failure rate on the configuration side in my opinion but it isn't as bad as I expected.

Posted: Mon Dec 12, 2005 8:14 pm
by Ambush Commander
Part of the benefits of XSLT, however, is a standardization of the template syntax (definitely a good thing).

Hmm... I suppose a full PHP XSLT transformer would be waaay to slow...