[Zope3-dev] Cross-breeding of ZPT and XSLT

Paul Everitt paul at zope-europe.org
Tue Dec 14 01:22:34 EST 2004


There's been some talk about Zope 3 and pipelines, XML rendering, XSLT, 
etc.  Richard Volpato emailed me some links that show some interesting 
cross-breeding between XSLT.  Specifically, Christian Stocker from 
Bitflux (a PHP-based CMS) has a "port" of ZPT to XSLT:

   http://blog.bitflux.ch/archive/further-improvements-on-xsl-tal.html

This article discusses the activity in different places (Bitflux, 
Cocoon) for a simplified templating system that still uses modern, 
high-speed XSLT engines.  Specifically, Christian has some working examples:

   http://wiki.bitflux.org/Templates_TAL_Example
   http://wiki.bitflux.org/Templates_TAL

This is a working example:

<?xml version="1.0" ?>
<html xmlns:tal="http://xml.zope.org/namespaces/tal">
     <head >
         <title tal:content="document/header/title">Here comes the 
title</title>
     </head>
     <body>
         <h1 tal:content="document/header/title"></h1>
         <p class="note">The layout of this HTML page is defined 
doc2html-template.xhtml</p>

         <div class="content" tal:repeat="s1 /document/body/s1">
             <div class="s1">
                 <h2 tal:content="$s1/@title">S1 Title</h2>
                 <div tal:replace="structure $s1/node()"> content</div>
             </div>
         </div>
     </body>
</html>

...that is executed using an XSLT processor.  Doesn't look like XSLT. 
:^)  Christian includes some extensions that optionally tap into 
XSLT-oriented functions (tal:match, tal:include).

The competing proposal from the Cocoon folks is similar in spirit to 
ZPT, but quite different in implementation.  Instead of namespaced 
attributes for substitution, it uses brackets containing expressions.

--Paul



More information about the Zope3-dev mailing list