[Grok-dev] guidance for incorporating XSLT as alternative templatingmechanism?

cstrong at arielpartners.com cstrong at arielpartners.com
Wed Dec 19 17:19:08 EST 2007


> cstrong at arielpartners.com wrote:
>> I would love to get a few pointers on how to go about adding XSLT as an
>> alternative templating mechanism.
>> My plan is to always emit and consume XML via the Amara library.
>> <snip/>

> I would use an IResult adapter.  In
> zope.publisher.http.HTTPResponse.setResult, Zope's publisher queries for
> an IResult multiadapter and will use that instead of the default
> publishing mechanism if available.  Instead of a unicode string, your
> application outputs a view-ish object that is adaptable to IResult, and
> you write an IResult adapter to take care of it from there.  The adapter
> has to set the content-type and content-length headers into the response
> and do any appropriate encoding, finally outputting a tuple of string
> (output,).  Inside the adapter, you may do any transforms you want on
> the object.
>
> I am working on some alpha code that's not quite ready for prime-time
> that uses this hook for doing something similar with lxml.  Let me know
> if you want to see it.
>
> -Jim Washington
>

Yes, please!  That would be very helpful.  I like lxml very much.  I only
chose Amara because it is pure Python and therefore easier to install on
all the myriad hardware platforms I care about.

--Craeg



More information about the Grok-dev mailing list