+ registry.registerTemplateNodeLibrary("tal", "http://xml.zope.org/namespaces/tal",
+ new CoreTemplateNodeLibrary("tal", "http://xml.zope.org/namespaces/tal"));
+ registry.registerTemplateNodeLibrary("metal", "http://xml.zope.org/namespaces/metal",
+ new MacroTemplateNodeLibrary("metal", "http://xml.zope.org/namespaces/metal"));
+
+ TemplateLibrary library = new TemplateLibrary() {
+ public Template lookupTemplate(String aTemplateName) throws TemplateProcessingException {
+ try {
+ TALTemplateParser parser = new TALTemplateParser(registry);
+
+ if (aTemplateName.equals("a")) {
+ return parser.parse("<test tal:on-error='${exception.message}'><bkla><font tal:content='${sdf'></bkla><td><b><font>bla</font></b></td></font>" +
+ "<test2 metal:use-macro=\"b#testmacro\"></test2><test3 a='b' tal:attributes='c a:${tagattributes.a}'> </test3> " +
+ "<test4 tal:content='the content was ${tagcontent}'>bla <b>die</b> bla ></test4><a width='100%'/>" +
+ "<test5 tal:bla=a><tal:bla/></test5> </test>", new MirExpressionParser());
+ }
+ else {
+ return parser.parse("<test3><test4 metal:define-macro=\"testmacro\">hoi</test4><test3>", new MirExpressionParser());
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ System.out.println(t.toString());
+ return null;
+ }
+ }
+ };
+
+ Map test = new HashMap();
+
+ Template template = library.lookupTemplate("a");
+
+ PrintWriter p = new PrintWriter(System.out);
+
+ template.process(new HashMap(), p, new TALLogger.TALSystemOutLogger(), library);
+
+ p.close();
+
+ }
+ catch (Throwable t) {
+ System.out.println("Exception: " + t.toString());
+ t.printStackTrace(System.out);
+ }
+ }
+ public static void main2(String args[]) {
+ try {
+ TALTemplateEngine engine = new TALTemplateEngine(
+ new MirExpressionParser(), new File("m:/romania/mir/etc/producer/"));