It is a very common need in software development to generate output which mixes pre-defined “boilerplate” content with parts which are generated dynamically. There are plenty of ways to address this need – one of them is to use a “template system”. A Typical use of a template system consists of the following components:
a collection of “templates”, each of which is a prototype output document containing some kind of tokens or expressions to indicate where (and what) dynamic data to insert.
- some way of finding or generating the dynamic values to be merged with a template
- some way of indicating which template(s) to use n which situations
- a “template engine” which brings the other parts together – loading an appropriate template and merging it with supplied dynamic data to produce an output document.