Re: [xslt] extension modules
- From: Thomas Broyer <tbroyer ltgt net>
- To: xslt gnome org
- Subject: Re: [xslt] extension modules
- Date: Thu, 19 Jul 2001 02:12:02 +0200
Le 19/07/01 01:58:05, Thomas Broyer a écrit :
> This is a proposal API to write extension modules. Please comment on so
> that we can choose an API and don't modify it afterwards.
> Suggestions are welcome, everything has to be discussed: is it necessary,
> are there other ways to solve the problem, etc.
>
> Also, please note these proposals do NOT bring into question the actual
> extension API, they only extend it.
>
> This version is the most complete one, the one I'd like to have. I'll
> send another message for a stripped-down version not including
> precomputation, and a third one for an alternative, based on the current
> extension API.
This is the stripped-down version.
=====
1. an extension module consists of:
· module data
· top-level elements
· extension elements
· extension functions
2. there is only 1 module data structure:
at transformation level, registered for each transformation
Used to share data between the module elements and functions (e.g.
to store a database access descriptor)
A module registers a couple of functions: an initialization and
a shutdown function to allocate and free the data.
Elements and functions can retrieve this data struct with
xsltGetExtData.
Data initialization is done automatically by xsltGetExtData if data is
not yet available (you callback function calls xsltGetExtData
for example; if data exists for the module, it is returned, otherwise
it is first initialized by the function you provided).
Shutdown happens at transformation end.
3. elements and functions are stored application-wide, globally.
A top-level element is defined by its name, namespace URI and a
callback function called just before any transformation:
void (*xsltExtModuleTopLevelFunc) (xsltStylesheetPtr style,
xmlNodePtr inst);
An extension element comes with a name, namespace URI and a callback
function (xsltTransformFunction)
An extension function is composed of a name, namespace URI and a
callback function (xmlXPathFunction)
Elements and functions have access to transformation data through
xsltGetExtData
Things to be discussed:
· transformation data initialization is done only when needed (except if
stylesheet data has been registered for that module).
Does someone think it could cause problems?
· there is no precomputation
· most probably other things I've forgotten...
Changes from the "complete version":
· no precomputation, top-level elements are processed for each
transformation
· no stylesheet data, things that were split into two phases (top-level
precomputation, then initialization just before a transformation)
have to be done in one phase by the top-level element callbacks.
Tom.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]