Jim Fulton wrote:
Paul Prescod wrote:
Of course Zope must eventually move into the XML world. Zope needs to do templates.
It already does, via DTML.
Right, but DTML code is not valid XML code. It can't be edited in an XML editor, stored in an XML repository, routed through XML-based workflow, etc. etc.
XSL also does templates.
I would have thought that XSL *was* a template mechanism. What do you mean by "template"?
XSL can be thought of as a template mechanism. But an XSL stylesheet has many templates and describes a flow of control between them, whereas DTML documents are a single template.
In fact templates are almost as central to XSL as they are to Zope.
I would say far more so,
Fair enough. I meant to say that that they are almost as central to XSL as they are to DTML. six of one...
I would suggest that Zope should use XSL template syntax for DTML templates as far as is possible.
It appears to me that DTML and XSL represent two very different approaches to solving the same or similar problems. They are both intended for generating text from objects. DTML generates text from Python objects. XSL generates text from XML objects.
Not quite. XSL generates XML objects (technically speaking, "nodes") from other XML objects (other nodes).
DTML takes a higly procedural approach. In DTML, you generate text directly. In XSL (as I understand it) you specify a set of rules for applying transformations to XML elements. This is fairly declarative in nature. In the example you gave, you didn't render a specific picture element. Instead, you have a rule for converting picture elements to img tags.
Right. But the same holds for DTML. You don't write DTML to generate an IMG tag for a specific picture. If you knew exactly what picture you wanted, you would use the HTML for it. You use DTML extensions when you want to figure out the picture to use at runtime, just like in XSL. I don't see this as a difference.
Another difference between DTML and XSL is in how content is determined. DTML is typically used to define as well as format content. A DTML document directly specifies data that is often extracted from large object spaces. In XSL, it appears that the content is largely defined by a source document and an XSL "template" simply specifies transformations. Of course, an XSL specification can also filter, so there is some ability to extract, but it is much less direct than with DTML.
What you seem to be saying is that DTML works on large Python object-bases and XSL works on small XML document inputs. But that is a difference in degree, not in kind. I could encode a phonebook as a single XML document and use XSL to generate a list of all of the numbers in a particular zipcode. How is that different from using DTML in the same context to solve the same problem? The big difference, of course, is that XSL's set of expressions is quite limited where as Python is quite flexible. That's why I propose using the same syntax but changing the expressions to be Python expressions.
Given the very different natures of DTML and XSL, I don't see much point in making the syntaxes all that consistent.
Do you have another XML-compliant syntax in mind or have you decided that XML compliance isn't critical?
It may very well. If Zope made it easy to generate XML from Zope (ie Python) objects, then people who like XSL could apply XSL transformations to the resulting XSL, bypassing DTML altogether.
Sure, but how do I specify the objects that I want to work on from the XSL stylesheet? You can't [*] export the database as a single XML document, so you must allow a syntax that allows drilling into Python objects: Python syntax. [*] It is vaguely possible that un-extended XSL could work directly on a Zope database if we could express all Python objects as XML data... this requires more thought...but even so, you couldn't evaluate arbitrary Python code, you could only refer to preexisting objects.
In other words, I see XSL as an alternative to DTML, not another form of it.
I don't really see the difference. Either an extended XSL replaces DTML or an XSL-syntax DTML replaces DTML. All I'm saying is that the next generation templating syntax should be XSL-based.
Or, DTML may turn out to be a good tool for generating XML from objects, and then XSL could be applied to DTML output, in which case the two would act in tandem.
Why have two steps? It seems better to just use XSL syntax, either extended with Python expression syntax or not. Paul Prescod - ISOGEN Consulting Engineer speaking for only himself http://itrc.uwaterloo.ca/~papresco "Sports utility vehicles are gated communities on wheels" - Anon