[stringtemplate-interest] if-condition in subtemplates
Sindre Svendby
sinsvend at gmail.com
Fri Aug 22 05:43:13 PDT 2008
Hi, I having problems with if-condition in subtemplate's (template's
that invokes other template's)
Imagine I _dont_ have a var called nVar and call firstTemplate:
----
group templ;
firstTemplate() ::= <<
$if(!nVar)$
$subTempl(...)$
$endif$
>>
subTempl() ::= <<
$if(!nVar)$ <--- Reporting
java.util.NoSuchElementException: no such attribute: nVar in template
context
..whatever..
$endif$
>>
----
In the StringTemplate Documentation it stand "IF actions test the
presence or absence of an attribute unless the object is a Boolean, in
which case it tests the attribute for true/false."
Is this error intentional? Is there any work-arounds, or have I just
no clue about what I'm doing :)
I have this problem with StringTemplate Group Files.
-- Sindre
More information about the stringtemplate-interest
mailing list