[PHPTAL] inserting information into attributes

Joshua Paine lists at fairsky.us
Thu May 18 15:42:22 CEST 2006


Stefan Schwardt wrote:
> attributes. I'd need something like
>    <element tal:attributes="data/newattributes" />

Nothing like this exists--you'd have to create it. XSL can handle this 
sort of thing, but I think PHPTAL is more meant for known (by the 
template designer) XML grammars.

If there are just a handful of possible attribute names, you can do 
something like:

attr->a3 = "v3"
attr->a5 = "v5"

<element tal:attributes="a1 attr/a1 | default; a2 attr/a2 | default; a3 
attr/a3 | default; a4 attr/a4 | default; a5 attr/a5 | default; a6 
attr/a6 | default" />

and get

<element a3="v3" a5="v5" />

-- 
Joshua Paine
Chief Tower Builder
LetterBlock Software
http://letterblock.com/



More information about the PHPTAL mailing list