[ZPT] playing with stylesheets in ZPT?

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Tue, 10 Apr 2001 16:57:27 +1000


Guido van Rossum wrote:
> Sounds like you've found a good reason for a feature that we
> originally considered but decided to throw out: a phase where
> arbitrary processing by Python code is allowed.  We couldn't figure
> out what the interface should be, and which part of the source should
> be accessible to the code, whether it should be passed text or a DOM
> tree, and whether it should be invoked before or after all parsing.

As it turns out, I've had to re-think our strategy in this area (time's a
little tight for playing like we'd all like me to ;). I've ended up coming
up with something that's actually much cleaner through manipulating the
page's <base> tag to get the image references sane.

I still think the processing would be very useful to have. I have vague
ideas of using it to have further transparency for the web designer. I'd do
it for tag attributes as well as contents. The designer can then use
library tools in Dreamweaver to insert special variations on <img> tags or
<form> tags, for example, so that the template can intelligently process
the tag at run-time.

Uh, if this isn't making much sense, how about an example...

   <input type="text" name="foo" value="bar"
tal:process="template/formDefault">

where the processing is done at parse-time, the processing could output

   <input type="text" name="foo" value="bar" tal:attributes="value
lazy:request/foo">

... now that'd be neat :)

Of course, this is a strong vote for the processing to be done at parse
time. It'd need to be after the HTML/XML parse so that the 'process' method
can be passed the tag attribute and content info. I'd want attributes,
plain text tag contents _and_ structured tag contents (DOM I think) passed
to the processing method. I see it as a kinda brief deviation from the
normal processing. It'd probably be reasonable to expect the processing
method to return a DOM structure. The the info is passed on to the TAL
compilation bits'n'pieces. Of course, I'm still very hazy on how this all
works, and I'm well aware that, if I'm unlucky, the structure of TAL might
not be capable of doing all this :)


    Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)