[Zope-dev] Re: ZPT for CSS, anyone?

Craeg K Strong cstrong at arielpartners.com
Fri Apr 2 08:21:29 EST 2004


Here is one option I happen to like:  generate CSS via XSLT from an XML 
dialect

It has the following pre-requisite: make XSLT available as part of the 
Zope framework.

Once you can rely on having XSLT as part of your framework (it really 
should be part
of "batteries included" IMHO), you can do interesting things like 
providing a transformer
for creating CSS files out of some sort of XML dialect.  Here is a 
snippet of one we created
at Ariel:

<CascadingStyleSheet>

  <FileName>ariel-letter</FileName>
  <Comment>
    Special style sheet to support printed Ariel Partners Letterhead
  </Comment>
 
  <CssElement>
    <ElementName>#header</ElementName>
   
    <Style>
      <StyleName>height</StyleName>
      <StyleValue>5 cm</StyleValue>
    </Style>
    <Style>
      <StyleName>right</StyleName>
      <StyleValue>1.0in</StyleValue>
    </Style>
  </CssElement>
...

If someone does not like the XSLT transformer that Zope would (in my 
proposal) provide
out of the box, they are free to substitute their own.  Since it would 
be integrated with ZPT,
you could use ZPT expressions to create the XML dynamically out of 
pieces and parts.
If the XSLT capability were integrated into ZPT somehow, it could be 
made cache aware
for greatest efficiency.

Of course, not everyone likes this kind of "generative programming" 
approach.  I find that
code generation tends to simplify alot of problems.

Just my 2c,

--Craeg

Richard Jones wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On Friday 02 Apr 2004 18:44, Chris Withers wrote:
>  
>
>>Ah, okay, I think building something purely for CSS would REALLY suck.
>>
>>Something which could generically build SQL, CSS, Emails I would be less
>>lielyl to vomit about...
>>
>>[snip] 
>>
>>So persuade the Python guys to make string interpolation as powerful as you
>>need it to be ;-)
>>    
>>
>
>Why don't we have a good, long look at:
>
>  http://www.python.org/cgi-bin/moinmoin/WebProgramming
>
>under the "Templating Systems" heading and make sure that someone else hasn't 
>already come up with a good system that templates SQL, CSS, email, etc 
>nicely.
>
>There's an awful lot of templating systems there...
>
>
> 
>




More information about the Zope-Dev mailing list