Template is inert chunk of cloneable markup. Markup inside template is hidden and will not have any side effect until it's activated, for example if there is a image tag, it's source will not be loaded until it is activated, bad path on the image tag will not show 404. Templates can be placed anywhere on the html. Content of the template is not accessible via normal selection techniques like document.getElementById or querySelector can't return child node of the template.
Defining template
<template id="mytemplate1">
<p> I will not be displayed until I am cloned and displayed on the page. <span class="injectsomething"></span></p>
</template>
Activating Template
<script>
var template = document.querySelector('template');
var clone = document.importNode(template.content, true);
clone.querySelector('.injectsomething').textContent = "This has been dynamically injected";
document.body.appendChild(clone);
</script>
If you are using nested templte, then each template has to be cloned and added separately.
Injecting Dynamic Data
You can have a place holder in the template which you can handle in the script to dynamically inject data. More convenient (as in case of angular {}[]) way of inserting data are available through polymer, though HTML5 and template spec does not require that support.