[stringtemplate-interest] Distinguish null and false in condition

Oliver Flege o.flege at market-maker.de
Thu Sep 21 01:47:36 PDT 2006


Hi,

recently, I used ST to render xml tags; for tags that contained a Boolean
value, I had to distinguish between a null value (output <tag xsi:nil="true"/>)
and either true or false (output <tag>true</tag> / <tag>false</tag>)

Since ST's if condition evaluates to false for both null and Boolean.FALSE,
I modified ST to support $if(?attr)$, which evaluates to true iff
attr is not null.

The changes necessary to support this are rather trivial (treat ? similar to
the ! operator and call chunk.testAttributeDefined(a) if ? is used,
that funtion returns true iff a is not null).

How about including this change in ST?


 Oliver




More information about the stringtemplate-interest mailing list