You are not logged in Log in Join
You are here: Home » Members » philh » nXMLDocument docs ;)

Log in
Name

Password

 

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 create some better docs as I can, but don't hold your breath!

nXMLDocument is available here.