[stringtemplate-interest] Indirect attribute lookup
Roman Odaisky
roma at qwertty.com
Sat Sep 6 01:38:34 PDT 2008
Greetings,
> >>> st = StringTemplate("$(a)$")
> >>> st["a"] = "b"
> >>> st["b"] = "c"
> >>> print unicode(st)
>
> b
>
> It is my understanding that this is supposed to print “c”. Am I severely
> mistaken?
Okay, I am, I was inattentive. $(something)$, it turns out, looks for a
template, not attribute.
What I was trying to achieve was:
<tag $["id", "class", "title", etc]:{name|$(name):{$name$="$it$ "}$}/>$
the idea was to be able to write
$tag(id={some-id}, title={some-title})$
and to get
<tag id="some-id" title="some-title" />
It turns out indirect attribute lookup is only available as attr.(property).
How can I then create a template like the above?
--
TIA
Roman.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2286 bytes
Desc: not available
Url : http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20080906/40aaf6ad/attachment.bin
More information about the stringtemplate-interest
mailing list