[stringtemplate-interest] Question on using index variable(<i> and <i0>) in invoked template
Jiwon Seo
jiwon at stanford.edu
Mon Nov 28 02:08:22 PST 2011
Hi,
I'm trying to invoke a template inside an anonymous template as following:
<sorted:{s|<if(s)><insert("pos", <i0>)><endif>}; separator=";\n">
So, for each value (s) in the attribute sorted, I want to add a string
generated by the template insert only when s has the value true.
When invoking the insert template, I need to pass the iteration count
(index of s in the sorted).
The above template code produces an error message that <i0> is
unexpected (more accurately, the "<" is unexpected).
How can I pass the iteration count to the invoked template?
Thanks!
More information about the stringtemplate-interest
mailing list