[stringtemplate-interest] Applying templates with more than one parameter to multi-valued attributes

Terence Parr parrt at cs.usfca.edu
Mon Oct 30 14:21:57 PST 2006


On Oct 28, 2006, at 11:50 AM, Varghese wrote:

> Hi,
>
> I seem to have trouble with applying templates to multi-valued
> attributes. These templates have more than one input parameter.
> The problem seems to be when applying templates to multi-valued
> attributes, if the enclosed template has more than one parameter, then
> the enclosed template cannot resolve the properties of the the formal
> argument(the iterated value)
>
> What am i missing?

Hi. Can you come up with a simple expression that doesn't work?

> The idea is a template formats an object and then calls on other
> templates to format collections in that object, and so on. The other
> templates need to access the enclosing template's attributes. Allowing
> enclosing attributes to pass through will solve this problem, but what
> if the called template needs the iterator index or a literal parameter
> as formal parameters eg:
>     <a.bList:bFormatter(aDisplay={<a.display>}, bIndex={<i>}), arg= 
> {ABC}>
> in which case the template definition would be
>     bFormatter(b, aDisplay, bIndex, arg) ::= <<...>>

Are you saying that example doesn't work?  Defining b but not setting  
a value will make it null as it hides anything above.

Ter


More information about the stringtemplate-interest mailing list