Thursday, January 31, 2008

Template processor

A template processor (also known as a template engine or a template parser) is software or a software component that is designed to combine one or more templates with a data model to produce one or more result documents. For purposes of this article, a result document is any kind of formatted output, including documents, web pages, or source code, either in whole or in fragments.

This may be a relational database, a source file such as XML, an alternate format of flat file database, a spreadsheet or any of other various sources of preformatted data. Some template processing systems are limited in the types of data that can be used. Others are designed for maximum flexibility and allow many different types of data.

The template engine is a specific kind of template processing module that exhibits all of the major features of a modern programming language. The term template engine evolved as a generalized description of programming languages whose primary or exclusive purpose was to process templates and data to output text. The use of this term is most notably applied to web development using a web template system, and it is also applied to other contexts as well.

Document generation frameworks typically use template processing as the central model for generating documents.