[stringtemplate-interest] Multi-valued argument stuff...

Tim Spurway tspurway at gmail.com
Mon Jun 25 12:47:22 PDT 2007


Howdy there,

I am assigning attributes to my template like so:

List<Map<String,Object>> x = getXFromSomewhere();
template.setAttribute( "someXes", x );

in my template, i can iterate the normal way.  For example:

$someXes:{ anX | This is the Y value of the $i$th X --> $anX.Y$ }

works like a charm.

however, this chunk of code doesn't work as expected:

$first(someXes):{ firstX | This is the Y value of first X --> $firstX.Y$ }
$rest(someXes):{ restX | This is the Y value of the $i$th X--> $restX.Y$ }

I am getting a traceback complaining:

"Class java.lang.String has no such attribute: Y ... "

on the execution of the $first(someXes): ... $ anonymous template,
surprisingly the $rest(...): ...$ template works as expected.

Is there an explanation?  Are lists of Maps supported as template attribute
values?

tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070625/c2769b6a/attachment.html 


More information about the stringtemplate-interest mailing list