[TransWarp] Template parsing and XML/HTML processing design

Phillip J. Eby pje at telecommunity.com
Mon Jul 21 09:10:07 EDT 2003

At 09:42 AM 7/21/03 +0200, Jean Jordaan wrote:
>>I think that ZPT still embed code in a web page, and that there's a 
>>better alternative.  If you've seen PSO (pso.sf.net), Twisted's Woven,
>OK, this sounds worthwhile to pursue ..
>><h1 model="foo" view="text">Title Goes Here</h1>
>. although one aspect of ZPT that I still miss here is that the templates 
>can be valid XML/XHTML with very little extra effort,
>by putting all template attributes in their own namespace.

It's allowed; see peak.web.templates.TEMPLATE_NS.  If the XHTML document 
doesn't define a namespace prefix that references the TEMPLATE_NS URI, 
however, the parser will assume you're using unprefixed attributes.

>  Perhaps
>it's just the purist in me, but I do think it'll be valuable to be able to 
>pass ZPT to a strict HTML validator without worrying about warnings due to 
>non-standard tags/attributes; or to process them with XSLT that applies 
>only the template namespace:
><h1 pt:model="foo" pt:view="text">Title Goes Here</h1>

Just do <body xmnls:pt="http://peak.telecommunity.com/peak.web.templates/"> 
and you're set.

>Will the ZPT shorthand of
><pt:heading_section model="foo" view="text">Title Goes Here
>be possible? If the view expands to more than a <h1> tag, or otherwise 
>doesn't correspond directly to a handy HTML tag, it can be less than 
>helpful to hang the template attributes off an
>arbitrary tag ..

View classes have total control over what text they produce, so you could 
make a 'text.notag' view that doesn't write the start and end tags.

More information about the PEAK mailing list