try {
TemplateFactory f = loader.newTemplateFactory("a.html", new TemplateModifier() {
public void modifyTemplate(TemplateDocument doc) {
try {
TemplateTokenizer tokenizer = new TemplateTokenizer(new InputStreamReader(new FileInputStream("b.html"), "UTF-8"));
TemplateParser parser = new TemplateParser(tokenizer, Expressions.cambridgeExpressionLanguage);
TemplateDocument document = parser.parse();
Tag tag = document.getElementsByTagName("body").get(0);
Tag bodyTag = doc.getElementsByTagName("body").get(0);