Re: [xslt] extension modules



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 third, basic 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.
   The initialization function also have the responsibility to register
   the elements and functions using xsltRegisterExt* functions

   Elements and functions can retrieve this data struct with a
   xsltGetExtData.

   During stylesheet precomputation, all the namespace declarations are
   registered. Just before each transformation, the processor calls the
   initialization function for each known namespace URI.
   Shutdown happens at transformation end.

3. elements and functions are stored in each transformation context,
   registered by the initialization function.
   Module registration consists only in a call to xsltRegisterExtModule.

   A top-level element is defined by its name, namespace URI and a
   callback function called just before any transformation:
     void (*xsltExtModuleTopLevelFunc) (xsltTransformContextPtr ctxt,
                                        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 even if not needed.
   Does someone think it could cause problems?
 · there is no precomputation

Changes from the "complete" version:
 · the initialization function is called even if not needed
 · it is also responsible for elements and functions registration
   module registration consists only in a call to xsltRegisterExtModule
 · no precomputation, no stylesheet data (and no mean to add it later)

Tom.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]