[ZPT] XSLT version of TAL, pushing caching to the client
bkc at murkworks.com
Thu Jul 21 10:18:56 EDT 2005
About 3 years ago I posted on this list asking if anyone else was
interested in using TAL/METAL to produce XSLT stylesheets that could
then be further processed.
The folks over at Bitflux have toyed with this a bit:
I've been playing with their TAL processing stylesheet (which they seem
to have stopped working on)
And have started adding fill-slot/define-slot support to it.
Also, trying to setup some unit tests.
All my Zope websites these days are more data driven then content
Each page "class" is a python script that returns an "XML context blob"
with a stylesheet PI. That stylesheet then generates the HTML (usually
on the client browser, but on the server if necessary).
By page "class", I mean that many URI's are handled by a single
pythonscript via traverse_subpath handling, and each script handles a
specific class of "page types".
The xslt stylesheets themselves also have xsl:include statements that
work, sorta like metal macros.
With further use of the document() function in the xslt stylesheets, 99% of
browsers can cache individual page fragments in the client's browser.
This approaches the ultimate goal of the ESI (Edge Side Includes)
Throw into that mix AJAX-style interfaces (sorry for buzzword use), and
the usefulness of XML-backed Zope sites increases dramatically.
Suddenly my RESTful data sources can be exposed, either by
compositing into the html page directly during HTML generation via the
document() function.. Or dynamically via XML-HTTP requests, or both!
Also, where appropriate, my data sources can render their output as XML
than sending XML.
Though in a pinch, I also have used an XSLT file to convert XML back
implemented in client browsers:
For my clients, using XML/XSLT as the basis for web-site architecture
has dramatically simplified my site designs, while simultaneously
increasing the flexability in interface creation through the composition of
data sources and templates (xslt).
Additionally, offline back-end processing via XSL-FO is now possible with
hardly any additional effort.
But back to ZPT and XSLT.
In ZPT, the TALES context space serves as the root of the data source
tree that is used to expand TAL elements.
ZPT sheets can be tested in-situ as they are being edited by clicking on
the test tab.
For TAL/XSLT, the context space comes from the "XML context blob"
(with the launch point stylesheet PI).
TAL to XSLT requires a pre-processing step, where the tal document is
converted to xslt. Perhaps this will be a three-step process if we want to
make METAL expansion a distinct phase (to ease previewing and editing
of the TAL page).
This makes working with TAL/XSLT at least a three-step process.
1. Metal expansion
2. TAL to XSLT
3. Final rendering of "XML context blob" to XHTML (or whatever). This
step usually occurs on the client browser.
Different XML context blobs can use the same XSLT stylesheet. So in
some respects this is somewhat similar to Zope acquisition, where the
"data context" can be applied to a "template context" through the
arrangement of the requesting URL.
So, is anyone interested in TAL to XSLT?
I guess I should have blogged about this instead.. Can't remember where
I left my blog...
Brad Clements, bkc at murkworks.com (315)268-1000
AOL-IM or SKYPE: BKClements
More information about the ZPT