[Zope] Zope, Cocoon, XSLT

Phil Harris phil.harris@zope.co.uk
Wed, 13 Jun 2001 09:23:08 +0100


I think it's time I officially released my nXMLDocument thingy.

I've mentioned it a few times on the list and a few have shown interest, but
it's never really been in any state to release, not even now really, but
here goes.

It is basically a sub-classed DTMLDocument which has the ability to render
itself via an XSLT stylesheet (which could be any type but a DTMLMethod
works best).

Both the nXMLDocument and the XSLT can have DTML in there to build up their
contents.

This gives a *very* flexible way of creating the XML on the fly.  You can
build them from DB calls for instance.

Since I run Zope on Win32 I tend to use the Microsoft XSL stuff, which works
extremely well since according to all the tests it is the fastest by quite a
margin.

I have though had it working with the 4thought and also the Sablotron stuff
as well, it will mean some tinkering with the product to get them to work
though (only one method in the product has to change).

There is zip docs at the moment, but basically this is how it works.

The XML doc is created, this should after first pass rendering be well
formed XML.

The XSLT is created which again should be well formed after first pass
rendering. (the XSLT is rendered in the same namespace as the XML, so titles
etc come from the nXMLDocument not from the parent of the XSLT.

Then you set a property somewhere in the acquisition path of the
nXMLDocument, called stylesheet.  This is the name of the XSLT.

There is some figuring out of which stylesheet to use in the __call__ method
of the nXMLDocument, basically it looks first in the URL for a
?stylesheet=foo_xsl parameter, then it looks for a property called
stylesheet in the acquisition path.  I have in the past used session
variables to allow for a skinning function which is based on user sessions
as well.

I'll release the product onto Zope.org if any one is interested.  Feedback
would be really good, but it seems to work at the moment (we have a site
that is done exclusively with it, about 1200 pages blah blah).

Laters,

Phil
----- Original Message -----
From: "Mike Krohn" <mike@krohn.org>
To: <christophe.robert6@wanadoo.fr>; <Zope@zope.org>
Sent: Wednesday, June 13, 2001 5:00 PM
Subject: Re: [Zope] Zope, Cocoon, XSLT


> Hi Christophe,
> I don't have any answers about Cocoon but I do have a
> similar problem.
>
> I use an XML page definition language which defines the
> objects that appear on a web page and their properties.
> There is an associated XSL stylesheet that transforms the
> XML into XHTML. The browser renders the XHTML and produces
> the page on the client screen. It's a good system for
> producing quick pages that conform to a standard look and
> feel.
>
> The problem is where to do the XSLT processing. At the
> moment I am doing it in the browser. Zope delivers the XML
> and the stylesheet and the browser does the transform. But
> it has to be IE5.5 with the MSXML3 add-in. Not too many
> people have that installed!
>
> In the non-Zope world, I would also be able to do the
> transform in the server. There is an ISAPI filter for IIS to
> do it. Though I have never tried, I think Cocoon can do it,
> too (presumably this is what you, Christophe, are looking
> at).
>
> I am new to Zope and don't really understand what is
> involved but it would be great if there was some way of
> routing the XML page definition to an XSLT processor before
> DTML processing. Or maybe after DTML processing - not sure
> about that. Or optionally before or after.
>
> Has anyone got any thoughts on that? Does something like it
> already exist? Is it possible to integrate sufficiently
> closely with Cocoon to achieve it part in Cocoon, part in
> Zope?
>
> ....Mike
>
> ----- Original Message -----
> From: "christophe robert" <christophe.robert6@wanadoo.fr>
> To: <Zope@zope.org>
> Sent: Saturday, June 09, 2001 8:06 AM
> Subject: [Zope] Zope and Cocoo
>
>
> : hello
> :
> : I would like to know if somebody tried to use cocoon with
> : zope while passing by the module mod_pcgi2 of apache.
> :
> : I would like to reproduce the same mechanism
> mod_php3/cocoon.
> :
> : To be able to simply use XSLT would be really sympathetic
> :
> : Thank
> :
> : _______________________________________________
> : Zope maillist  -  Zope@zope.org
> : http://lists.zope.org/mailman/listinfo/zope
> : **   No cross posts or HTML encoding!  **
> : (Related lists -
> :  http://lists.zope.org/mailman/listinfo/zope-announce
> :  http://lists.zope.org/mailman/listinfo/zope-dev )
> :
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )