FreeMarker has a nasty dependency on AWT. It makes it impossible to use with things like Google App Engine.
I prefer to use StringTemplate for all my Java templating needs. It is the only Java based template system that strictly separates the logic from the template.
StringTemplate is a java template engine (with ports for C#, Python,
Ruby, and Scala) for generating source code, web pages, emails, or any
other formatted text output. StringTemplate is particularly good at
multi-targeted code generators, multiple site skins, and
internationalization/localization
Its distinguishing characteristic is that it strictly enforces
model-view separation unlike other engines. Strict separation makes
websites and code generators more flexible and maintainable; it also
provides an excellent defense against malicious template authors.
Since you are generating XML
Another solution that isn't obvious at first sight is using JAXB. We have a project here that requires us to generate XML, we have very well defined XSD files for the output files, building the objects and marshalling them is super easy and very painless.