Note - this document is still a work in progress. Please do
not make inline comments in the proposal - use the
XSLTMethodDiscussion to make comments.
Contact
Fourthought Inc. (4zope@fourthought.com)
Problem
As it currently stands, the XMLDocument effort is only
half the battle in the Content and Presentation paradigm. see zope-xml big
idea
. The next step is to provide another transformation mechanism for turning
XML content into presentable information.
Proposed Solution
An XSLTMethod will be an object that contains a XSLT Stylesheet. The object will support interfaces to
apply the template to any object that supports the DOM Level II interface.
It could be applied to an object in Zope through acuisition, explicitly
to any python object, to a serialized XML Document, or given a URL to
retrieve.
Some examples of how this would look in python:
results = xslt.processUri("http://www.fourthought.com")
results = xslt.processNode(node)
results = xslt.processString("<employees/>")
The call interface will also be supported. Assuing you have a XMLDocument accessible by http://foo.bar/data/xmlSrc, and a XSLTMethod called viewByDate, then XSLTMethod can be applied to the XMLDocument as follows:
http://foo.bar/data/xmlSrc/viewByDaye
With Zope extension functions and extension elements, XSLT Methods
will have access to the python enviroinment inwhich they were called so
programmers can take full advantage of all that is Zope.
XSLT also provides a powerful extension mechanism which will allow
programmers to go "outside the box" and accomplish anything that python
allows.
For a simple example demonstrating conceptual usage, lets assume you have a contact database in XML format in an XMLDocument object and you want the information displayed in a readable format. You would create an XSLT stylesheet and instanciate it as an XSLT Template object in the zope heirarchy. This stylesheet would have template matches for specific parts of the XML schema and would be very easy and intuitive to create. The template matches would be able to render the information in a nice HTML format or to XSL's fo schema (from which it can be easily transformed to PDF, PS, etc).
For those unfamiliar with XSLT or want more specific artifacts on XSLT stylesheets and stylesheet processing please refer to W3cx's in depth specification on XSL transformations: http://www.w3.org/TR/xsl/
Features
Transparent architechtural integration with XMLDocument and !ZDOM
No additional learning curve (besides that associated with XSLT alone)
Able to do as much as DTML in terms of manipulating Zope Objects and the Zope environment (not a binding requirment)
Risks
Scope
The scope of the initial project will include integration of 4XSLT into
Zope as a Zope Product. A set of initial extension functions and elements
will be developed. The initial scope does not include any zope-only
optimization to the processor unless the product is unuseable without them.
It also does not include integration of XSLT into any other areas of Zope.
Deliverables
|