I'll try to make my problem seem simple, hoping that the solution will be.
Let's state that we have two templates as following :
html(data,value,charts) ::= <<
<!DOCTYPE HTML>
<html>
[...]
var $data$ = $value$;
$charts$
[...]
</html>
>>
chart(chartname,data,categoryname,graphs) ::= <<
var $chartname$;
$chartname$.dataProvider = $data$;
[...]
>>
In Java, I have to do something like:
ST myPage = group.getInstanceOf("html");
ST chart1 = group.getInstanceOf("chart");
ST chart2 = group.getInstanceOf("chart");
myPage.add("data", xxx );
chart1.add("data", xxx );
chart2.add("data", xxx );
BUT, "data" is the same for all (code duplication!), so I would like to apply the "chart" template on data in my "html" template with something like :
html(data,value,charts) ::= <<
[...]
var $data$ = $value$;
$charts(data)$
[...]
>>
Which is not possible, because the "chart" template as more parameter than just "data".
My question is : How to call the "chart" template, using "html"."data" for "chart"."data" but by keeping the usual way to set parameter at runtime with .add(String, Object) ..?
Thank you for your time !