[stringtemplate-interest] quick question

Micheal J open.zone at virgin.net
Wed May 10 14:08:21 PDT 2006


$["1", "2", "3"]:{index|
    <tr><td>$index$</td></tr>
}$
 
Just off the top of my head and may not work. ;-)
 
Micheal

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of David Moshal
Sent: 10 May 2006 21:34
To: Terence Parr; stringtemplate-interest
Subject: Re: [stringtemplate-interest] quick question


Thanks for the responses, I don't think I've presented the problem well
enough.
Let me give you the jsp code, and see how you'd do it in ST:

<% for (int i=0; i< 3: i++) { %>

  <tr> <td> <%=i%> </td></tr> 

<% } %>

Thanks again
Dave



On 5/10/06, Terence Parr <parrt at cs.usfca.edu> wrote: 

Note that you can parallel iterate:

<names,phones : {n,p | ...}>

:)

naturally names can also be a list of lists etc...

Ter
On May 10, 2006, at 1:22 PM, Jose San Leandro wrote:

> For the first question if I understood well you should be able to
> do something 
> like
>
> <["tr1", "tr2", "tr3"],["td1-1", "td2-1", "tr3-1"], ["td1-2",
> "td2-2"],
> ["td1-3"]:{row, td1, td2, td3|\<tr 
> id="<row>">\<td><td1>\</td>\<td><td2>\</td>\<td><td3>\<td>\<tr>};
> separator="\n">
>
> An array of arrays of strings would be better, but there's no 
> method to
> retrieve an iterator on each row, so I guess it cannot be used. I
> mean the
> best would be to use as input something like
>
> <[["td1-1", "td1-2", "td1-3"], ["td2-1", "td2-2"], ["td3-1"]]: 
> {row|... }>
>
>
> On Wednesday 10 May 2006 21:56, David Moshal wrote:
>> Kay - I'm not sure if I explained the problem - I want to create a
>> fixed
>> number of rows, eg 3. 
>> There is no model in this case.
>>
>> BTW - thanks for the Ter's i18n article - I'm going to look into the
>> attribute renderer class, it
>> clearly is a superior way of solving my prior problem regarding 
>> formatting.
>> Do you know if
>> one can set an attribute renderer as a wrapper around a whole
>> model object?
>>
>> Dave
>>
>> On 5/10/06, Kay Roepke < kroepke at dolphin-services.de> wrote:
>>> On 10. May 2006, at 19:55 Uhr, David Moshal wrote:
>>>> Hi - I apologize in advance if this is a completely obvious 
>>>> question:
>>>>
>>>> How does one iterate in ST?
>>>>
>>>> ie, If I want to create a table with, say 10 rows, how is this
>>>> done: 
>>>
>>> (using the AngleBracketTemplateLexer:)
>>>
>>> <rows:{row|\<tr><row.datacells:{data|\<td>data.contents\</td>}>\</
>>> tr>}; separator="\n"> 
>>>
>>> See: http://www.stringtemplate.org/doc/doc.tml
>>>
>>> HTH,
>>>
>>> -k
> _______________________________________________ 
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest

_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest at antlr.org
<mailto:stringtemplate-interest at antlr.org> 
http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20060510/e01ef70c/attachment-0001.html


More information about the stringtemplate-interest mailing list