|laziness, impatience, and hubris|
Model-View-Controller: Template Toolkit vs. XSLTby kvale (Monsignor)
|on Oct 14, 2004 at 16:12 UTC||Need Help??|
The Model-View-Controller (MVC) pattern separates an application into three components:
For a future web application, I am meditating on the best approach to take for the view and model. There are two general approaches I am looking at.
The first is a traditional perl templating scheme. The model would be a flat file or relational database, bound to a perl program through DBI. The view would consist of a set of template documents that would transform data to various formats (HTML, plain text, CSV, etc.) using, for example, Template::Toolkit.
The second approach is to build an XML application. The model stores data in an XML format and is accessed directly, or perhaps using XML::LibXML. The view would consist of a set of template documents that would transform data to various formats (HTML, plain text, CSV, etc.) using the XSLT language via, e.g., XML::LibXSLT.
I have little experience with either templating scheme, and I am seeking advice on the pros and cons of these two approaches. I understand that the subject of XML vs. relational databases is contentious. Let's assume that I am comfortable implementing either variety. and that the database will be small enough that performance considerations will not be foremost in the design. Also, if performance becomes a problem, I could create an XML wrapper around DBI results. So the comparison becomes that of a perl templating language vs. XSLT.
Some questions pertaining to the comparison are