[stringtemplate-interest] Rg Need ur Suggestion

Terence Parr parrt at cs.usfca.edu
Fri Sep 4 14:44:58 PDT 2009


are you passing in a boolean or string? if string, it won't work as  
you want.
T
On Sep 3, 2009, at 11:09 PM, Viuha Sundararajan wrote:

> Hello,
>
> i have created a st file as mentioned below:-
>
> $QP$
> $State$ $StateCode$
>                 $Summery$
> $Purpose$                             $Date$
> $if(member)$
> $membermsg()$
> $else$
> $nonmembermsg()$
> $endif$
>
>
> For this st file, iam trying to assign value from an Xml file
>
> <?xml version="1.0" encoding="utf-8"?>
> <HeaderInfo>
> <QP>QP HDQ0PC0</QP>
> <State>.MIAXUCO</State>
> <StateCode>202230</StateCode>
> <Summery>SUMMERY OF DLAYED FLIGHTS ATTRIBUTED TO</Summery>
> <Purpose>FLIGHT OPERATIONS</Purpose>
> <Date>June 202008</Date>
> <FlightType>FROM 0001 TO 2359</FlightType>
> <Time>LOCAL TIME</Time>
> <member>false</member>
> </HeaderInfo
>
> Now based on the value available in member element, i need to call  
> another st file either membermsg() or nonmembermsg().
> Note these two st files are located within same  StringTemplateGroup  
> location.
>
> The problem iam facing here is, at any point in time ,it is not  
> calling st file mentioned in else part.
>
> Please advice whether is there any issue in my conditional stmt  
> mentioned in the st file.
>
> Regards,
>
> Sundar.
> On Fri, Sep 4, 2009 at 12:01 AM, Terence Parr <parrt at cs.usfca.edu>  
> wrote:
> use a conditional?
> T
>
> On Sep 3, 2009, at 9:49 AM, Viuha Sundararajan wrote:
>
> Hello,
>
> Does the String Template class support turning off a template within  
> another template?
> For instance say I have a template that contains another template -  
> %MA_TEMPLATE%
>
>
> DT $OFFICE$ $GEO$ $TIME$ $SEQ$  %MA_TEMPLATE%
>
>
> Where  MA_TEMPLATE is
> /MA $NBR$
>
> I want to be able to turn off MA_TEAMPLATE if the data element  
> NEEDS_MA = false
>
> So if NEEDS_MA = true - the result after substituting the values is
>
> DT HDL SHB 160337  026A  /MA 003
>
> If NEEDS_MA = fase - the result after substituting the values is
>
> DT HDL SHB 160337  026A
>
> How would I do that with the String Template  Is this possible?
>
> Awaiting your response
>
> Thanks a lot
> Sundar.
> _______________________________________________
> 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