cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject Garbage or The Quest for the Perfect Template Language
Date Thu, 31 Jul 2003 22:31:47 GMT
These days I'm banging my head against the limitations of template
languages. I've tried XSP and it's not in any way limited, but it has
its share of problems (difficult to debug and offers too many ways to
shoot oneself in the foot), JXTemplate{Transformer,Generator} (no way to
call methods on context objects, no decent arithmetic) and Velocity
(stream based, no FP math).

I've read about Garbage but I haven't tried it. It looks promising
though, and I hope that Pier is going to really push it forward when he
finds some free time.

There are a couple of things that a good template language should do.
Consider the following requirement: given a model consisting of a list
of floating point numbers, print all of them, localizing their
represantion according to some locale, then compute and display their sum.

You can format the numbers using Velocity, but you must explicitly pass
an instance of DecimalFormat to the view. I'd like the template language
to have built-in support for the localization of numbers, currencies and

You cannot apparently sum the numbers using Velocity. I was startled to
discover, the other day, that if you try to sum doubles with Velocity,
it will instead concatenate their string representations! I hope it was
a mistake of mine, because it would really be dumb if it were indeed the
case. Anyway, whatever the language we come up with, it should be able
to correctly perform floating point arithmetic.

This is my plea for the perfect template language and I hope that,
whoever implements it, considers adding these features.


View raw message