I've had great luck with
Andy Wardley's Template Toolkit (
cpan). It is a very powerful general purpose templating system. Futhermore, since the template gets processed into a scalar you can then embed the oputput into another template and so on. I believe this will provide you with the dynamism that you are looking for.
Good Luck!