A template is a document that can be applied on a data object to produce another document. Thus templates are used to present data or content in different styles and formats.
A typical template engine works in the following way:
The template engine accepts both data and the template, and a new document is generated and returned as per the template provided.
For example, an XML document can be used as data, and an XSLT document works as the template—this generates a new document that can be in HTML or Word format.
There are quite a few template engines available. XSLT is probably the most popularly used. Other engines are like FreeMarker templates, Velocity templates, and so on. Alfresco uses FreeMarker as the default template engine.