How to apply a template?