Transform View without XSLT
Moderator: General Moderators
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Transform View without XSLT
How would one go about implementing a Transform View without XSLT?
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Re: 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.Ambush Commander wrote:How would one go about implementing a Transform View without XSLT?
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.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
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.
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.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
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!"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...)
As you pointed out some customers may have more problems getting XSLT working than others. That's usually something I try to avoid.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
'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.
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.
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.
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.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US