[stringtemplate-interest] Referense template in other file.
Andrew Melnichuk
andrew.melnichuk at gmail.com
Mon Apr 16 03:29:40 PDT 2007
Hi.
I have a template group file 'basegroup.stg' and it contains definition of
simple template
group basegroup;
page1() ::= "$sharedview/somecontent()$"
There is a subdirectory called 'sharedview' which contains template file '
somecontent.st' with simple content:
<p>Some_content_to_show</p>
I'm trying to load tempalte group and display 'page1' template, and i'm
awaiting that it displays content from referenced tempalte as well, but i
have an error:
StringTemplateGroup.RegisterDefaultLexer(typeof(DefaultTemplateLexer));
StringTemplateGroup.RegisterGroupLoader(new CommonGroupLoader(
ConsoleErrorListener.DefaultConsoleListener));
StringTemplateGroup stg = StringTemplateGroup.LoadGroup("basegroup");
StringTemplate stPage = stg.GetInstanceOf("page1");
Console.WriteLine(stPage.ToString()); // exception !!!!
Unhandled Exception: Antlr.StringTemplate.TemplateLoadException: Can't load
template 'sharedview/somecontent.st'; context is [page1]
I suppose that referenced template must be defined in same group, correct me
if i'm wrong. But is there any way to solve above problem? I just dont want
to define all shared templates in same base group file.
--
Best regards,
Andrew Melnichuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070416/5d738f9b/attachment.html
More information about the stringtemplate-interest
mailing list