In our approach we try to call

template = Velocity.getTemplate(templateFile);

before loading the templates containing the macro definitions. The
above call builds the node tree. But if this file contains a call to a
macro in a seperate macro file the macro is not registered yet(the
macros in the macro library files are registeres after the
template.merge). So it does not register the call as a macro call.

I think we can overcome this problem by loading the macro files before
the calling the Velocity.getTemplate method.

Context context = new VelocityContext();
List macroFiles = new ArrayList();
macroFiles.add("macro_library1.vm");
macroFiles.add("macro_library2.vm");

Velocity.resiterMacroLibsForTamplate(templateFile, macroFiles);

template = Velocity.getTemplate(templateFile);
Writer writer = new new OutputStreamWriter(outFileName);

template.merge(context, writer);


Regards,
Supun..

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to