Results 1 to 2 of 2
Thread: XSLT as template engine for php?
May 9, 2009, 15:49 #1
XSLT as template engine for php?
There are so many templating engines like smarty, flexy, phptal, Html_Template_Sigma to name a few. More of them have some php code inside the template. Only the Html_Template_Sigma seems to implement a complete separation of html and php code.
Some are faster than others. usually if the ones that require some type of php code or loops inside the template are the faster ones, so the speed of template engine comes are a cost of being less separated from html, meaning a non-programmer may have harder time editing such templates.
This brings the question: are anyone in this forum using the XSLT templates as a templating engine? The XSLT is not a simple template to master, certainly not easy for non-programmer to edit or even understand.
But it seems to me that there would be some benefits to using it - php supports in with built-in xsl extension, it's a standard, meaning you can always find an expert to design a template for you.
All that is required is that your script outputs an xml instead of the html, then xsl processor loads your xml + your xslt template and spits out a well-formatted html.
And creating xml string from data in database if easy, you can use DOM, SimpleXML, or even sql2xml class from pear.
The only question still remains for me - how fast or how slow is the XSL processor comparing to using Smarty templates for example?
Has anyone researched this topic or actually using XSLT templates as the site's template engine?