[stringtemplate-interest] need for null test
Terence Parr
parrt at cs.usfca.edu
Mon Jan 17 09:22:33 PST 2011
try a map
m ::= [ "true" : ..., "false":"<tag>false</tag>", default: "<tag nil=\"true\"/>"]
then $m.(yourTagValue)$
If that works, lemme know. i'll add to faq.
Ter
On Jan 17, 2011, at 1:30 AM, Oliver Flege wrote:
>
> Hi,
>
> we use an enhanced version of ST3 for xml rendering and while ST4 makes
> most of our enhancements obsolete (in particular by supporting adaptors),
> one crucial omission remains:
>
> In order to render Boolean types declared as "xsd:boolean nillable=true" in an xsd,
> we need to distinguish between false and null values, as the output has to
> be either
> <tag>false</tag> or <tag nil="true"/>, respectively.
>
> I couldn't find any way to express this logic using ST4's if statement
> given a Boolean attribute, as false and null both evaluate to false.
>
> If that kind of logic can be expressed in ST4, I'd really appreciate any hint
> on how its done; otherwise I think that a "test for null"-expression should be added
> to the language, e.g., "if (?foo) ... "
>
>
>
> Regards,
> Oliver
>
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list