mardi 14 décembre 2004

Christian Stocker and ZPT/XSLT cross-breeding

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:

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 (1, 2).

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. [wink] 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. Hard to tell what would look more natural to a web designer.
7:25:55 AM   comment []