extensions

extensions - interface for the extension support

This provide the API needed for simple and module extension support.

Author(s): Daniel Veillard

Synopsis

int	xsltCheckExtPrefix		(xsltStylesheetPtr style, 
const xmlChar * URI); int xsltCheckExtURI (xsltStylesheetPtr style,
const xmlChar * URI); void xsltDebugDumpExtensions (FILE * output); xsltTransformFunction xsltExtElementLookup (xsltTransformContextPtr ctxt,
const xmlChar * name,
const xmlChar * URI); typedef void * xsltExtInitFunction (xsltTransformContextPtr ctxt,
const xmlChar * URI); xsltTransformFunction xsltExtModuleElementLookup (const xmlChar * name,
const xmlChar * URI); xsltPreComputeFunction xsltExtModuleElementPreComputeLookup (const xmlChar * name,
const xmlChar * URI); xmlXPathFunction xsltExtModuleFunctionLookup (const xmlChar * name,
const xmlChar * URI); xsltTopLevelFunction xsltExtModuleTopLevelLookup (const xmlChar * name,
const xmlChar * URI); typedef void xsltExtShutdownFunction (xsltTransformContextPtr ctxt,
const xmlChar * URI,
void * data); void xsltFreeCtxtExts (xsltTransformContextPtr ctxt); void xsltFreeExts (xsltStylesheetPtr style); void * xsltGetExtData (xsltTransformContextPtr ctxt,
const xmlChar * URI); xmlHashTablePtr xsltGetExtInfo (xsltStylesheetPtr style,
const xmlChar * URI); int xsltInitCtxtExts (xsltTransformContextPtr ctxt); void xsltInitElemPreComp (xsltElemPreCompPtr comp,
xsltStylesheetPtr style,
xmlNodePtr inst,
xsltTransformFunction function,
xsltElemPreCompDeallocator freeFunc); void xsltInitGlobals (void); xsltElemPreCompPtr xsltNewElemPreComp (xsltStylesheetPtr style,
xmlNodePtr inst,
xsltTransformFunction function); xsltElemPreCompPtr xsltPreComputeExtModuleElement (xsltStylesheetPtr style,
xmlNodePtr inst); typedef xsltElemPreCompPtr xsltPreComputeFunction (xsltStylesheetPtr style,
xmlNodePtr inst,
xsltTransformFunction function); int xsltRegisterExtElement (xsltTransformContextPtr ctxt,
const xmlChar * name,
const xmlChar * URI,
xsltTransformFunction function); int xsltRegisterExtFunction (xsltTransformContextPtr ctxt,
const xmlChar * name,
const xmlChar * URI,
xmlXPathFunction function); int xsltRegisterExtModule (const xmlChar * URI,
xsltExtInitFunction initFunc,
xsltExtShutdownFunction shutdownFunc); int xsltRegisterExtModuleElement (const xmlChar * name,
const xmlChar * URI,
xsltPreComputeFunction precomp,
xsltTransformFunction transform); int xsltRegisterExtModuleFull (const xmlChar * URI,
xsltExtInitFunction initFunc,
xsltExtShutdownFunction shutdownFunc,
xsltStyleExtInitFunction styleInitFunc,
xsltStyleExtShutdownFunction styleShutdownFunc); int xsltRegisterExtModuleFunction (const xmlChar * name,
const xmlChar * URI,
xmlXPathFunction function); int xsltRegisterExtModuleTopLevel (const xmlChar * name,
const xmlChar * URI,
xsltTopLevelFunction function); int xsltRegisterExtPrefix (xsltStylesheetPtr style,
const xmlChar * prefix,
const xmlChar * URI); void xsltRegisterTestModule (void); void xsltShutdownCtxtExts (xsltTransformContextPtr ctxt); void xsltShutdownExts (xsltStylesheetPtr style); typedef void * xsltStyleExtInitFunction (xsltStylesheetPtr style,
const xmlChar * URI); typedef void xsltStyleExtShutdownFunction (xsltStylesheetPtr style,
const xmlChar * URI,
void * data); void * xsltStyleGetExtData (xsltStylesheetPtr style,
const xmlChar * URI); void * xsltStyleStylesheetLevelGetExtData (xsltStylesheetPtr style,
const xmlChar * URI); typedef void xsltTopLevelFunction (xsltStylesheetPtr style,
xmlNodePtr inst); int xsltUnregisterExtModule (const xmlChar * URI); int xsltUnregisterExtModuleElement (const xmlChar * name,
const xmlChar * URI); int xsltUnregisterExtModuleFunction (const xmlChar * name,
const xmlChar * URI); int xsltUnregisterExtModuleTopLevel (const xmlChar * name,
const xmlChar * URI); xsltTransformContextPtr xsltXPathGetTransformContext (xmlXPathParserContextPtr ctxt);

Description

Details

Function type xsltExtInitFunction

void *	xsltExtInitFunction		(xsltTransformContextPtr ctxt, 
const xmlChar * URI)

A function called at initialization time of an XSLT extension module.

ctxt:an XSLT transformation context
URI:the namespace URI for the extension
Returns:a pointer to the module specific data for this transformation.

Function type xsltExtShutdownFunction

void	xsltExtShutdownFunction		(xsltTransformContextPtr ctxt, 
const xmlChar * URI,
void * data)

A function called at shutdown time of an XSLT extension module.

ctxt:an XSLT transformation context
URI:the namespace URI for the extension
data:the data associated to this module

Function type xsltPreComputeFunction

xsltElemPreCompPtr	xsltPreComputeFunction	(xsltStylesheetPtr style, 
xmlNodePtr inst,
xsltTransformFunction function)

style:
inst:
function:
Returns:

Function type xsltStyleExtInitFunction

void *	xsltStyleExtInitFunction	(xsltStylesheetPtr style, 
const xmlChar * URI)

A function called at initialization time of an XSLT extension module.

style:
URI:the namespace URI for the extension
Returns:a pointer to the module specific data for this transformation.

Function type xsltStyleExtShutdownFunction

void	xsltStyleExtShutdownFunction	(xsltStylesheetPtr style, 
const xmlChar * URI,
void * data)

A function called at shutdown time of an XSLT extension module.

style:
URI:the namespace URI for the extension
data:the data associated to this module


xsltCheckExtPrefix ()

int	xsltCheckExtPrefix		(xsltStylesheetPtr style, 
const xmlChar * URI)

Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltGetInheritedNsList() (xslt.c) xsltParseTemplateContent (xslt.c)

style:the stylesheet
URI:the namespace prefix (possibly NULL)
Returns:1 if this is an extension, 0 otherwise

xsltCheckExtURI ()

int	xsltCheckExtURI			(xsltStylesheetPtr style, 
const xmlChar * URI)

Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltPrecomputeStylesheet() (xslt.c) xsltParseTemplateContent (xslt.c)

style:the stylesheet
URI:the namespace URI (possibly NULL)
Returns:1 if this is an extension, 0 otherwise


xsltExtElementLookup ()

xsltTransformFunction	xsltExtElementLookup	(xsltTransformContextPtr ctxt, 
const xmlChar * name,
const xmlChar * URI)

Looks up an extension element. @ctxt can be NULL to search only in module elements.

ctxt:an XSLT process context
name:the element name
URI:the element namespace URI
Returns:the element callback or NULL if not found

xsltExtModuleElementLookup ()

xsltTransformFunction	xsltExtModuleElementLookup	(const xmlChar * name, 
const xmlChar * URI)

Looks up an extension module element

name:the element name
URI:the element namespace URI
Returns:the callback function if found, NULL otherwise.

xsltExtModuleElementPreComputeLookup ()

xsltPreComputeFunction	xsltExtModuleElementPreComputeLookup	(const xmlChar * name, 
const xmlChar * URI)

Looks up an extension module element pre-computation function

name:the element name
URI:the element namespace URI
Returns:the callback function if found, NULL otherwise.


xsltExtModuleTopLevelLookup ()

xsltTopLevelFunction	xsltExtModuleTopLevelLookup	(const xmlChar * name, 
const xmlChar * URI)

Looks up an extension module top-level element

name:the top-level element name
URI:the top-level element namespace URI
Returns:the callback function if found, NULL otherwise.

xsltFreeCtxtExts ()

void	xsltFreeCtxtExts		(xsltTransformContextPtr ctxt)

Free the XSLT extension data

ctxt:an XSLT transformation context

xsltFreeExts ()

void	xsltFreeExts			(xsltStylesheetPtr style)

Free up the memory used by XSLT extensions in a stylesheet

style:an XSLT stylesheet

xsltGetExtData ()

void *	xsltGetExtData			(xsltTransformContextPtr ctxt, 
const xmlChar * URI)

Retrieve the data associated to the extension module in this given transformation.

ctxt:an XSLT transformation context
URI:the URI associated to the exension module
Returns:the pointer or NULL if not present

xsltGetExtInfo ()

xmlHashTablePtr	xsltGetExtInfo		(xsltStylesheetPtr style, 
const xmlChar * URI)

looks up URI in extInfos of the stylesheet

style:pointer to a stylesheet
URI:the namespace URI desired
Returns:a pointer to the hash table if found, else NULL

xsltInitCtxtExts ()

int	xsltInitCtxtExts		(xsltTransformContextPtr ctxt)

Initialize the set of modules with registered stylesheet data

ctxt:an XSLT transformation context
Returns:the number of modules initialized or -1 in case of error

xsltInitElemPreComp ()

void	xsltInitElemPreComp		(xsltElemPreCompPtr comp, 
xsltStylesheetPtr style,
xmlNodePtr inst,
xsltTransformFunction function,
xsltElemPreCompDeallocator freeFunc)

Initializes an existing #xsltElemPreComp structure. This is usefull when extending an #xsltElemPreComp to store precomputed data. This function MUST be called on any extension element precomputed data struct.

comp:an #xsltElemPreComp (or generally a derived structure)
style:the XSLT stylesheet
inst:the element node
function:the transform function
freeFunc:the @comp deallocator


xsltNewElemPreComp ()

xsltElemPreCompPtr	xsltNewElemPreComp	(xsltStylesheetPtr style, 
xmlNodePtr inst,
xsltTransformFunction function)

Creates and initializes an #xsltElemPreComp

style:the XSLT stylesheet
inst:the element node
function:the transform function
Returns:the new and initialized #xsltElemPreComp

xsltPreComputeExtModuleElement ()

xsltElemPreCompPtr	xsltPreComputeExtModuleElement	(xsltStylesheetPtr style, 
xmlNodePtr inst)

Precomputes an extension module element

style:the stylesheet
inst:the element node
Returns:the precomputed data

xsltRegisterExtElement ()

int	xsltRegisterExtElement		(xsltTransformContextPtr ctxt, 
const xmlChar * name,
const xmlChar * URI,
xsltTransformFunction function)

Registers an extension element

ctxt:an XSLT transformation context
name:the name of the element
URI:the URI associated to the element
function:the actual implementation which should be called
Returns:0 in case of success, -1 in case of failure

xsltRegisterExtFunction ()

int	xsltRegisterExtFunction		(xsltTransformContextPtr ctxt, 
const xmlChar * name,
const xmlChar * URI,
xmlXPathFunction function)

Registers an extension function

ctxt:an XSLT transformation context
name:the name of the element
URI:the URI associated to the element
function:the actual implementation which should be called
Returns:0 in case of success, -1 in case of failure

xsltRegisterExtModule ()

int	xsltRegisterExtModule		(const xmlChar * URI, 
xsltExtInitFunction initFunc,
xsltExtShutdownFunction shutdownFunc)

Register an XSLT extension module to the library.

URI:URI associated to this module
initFunc:the module initialization function
shutdownFunc:the module shutdown function
Returns:0 if sucessful, -1 in case of error

xsltRegisterExtModuleElement ()

int	xsltRegisterExtModuleElement	(const xmlChar * name, 
const xmlChar * URI,
xsltPreComputeFunction precomp,
xsltTransformFunction transform)

Registers an extension module element.

name:the element name
URI:the element namespace URI
precomp:the pre-computation callback
transform:the transformation callback
Returns:0 if successful, -1 in case of error.

xsltRegisterExtModuleFull ()

int	xsltRegisterExtModuleFull	(const xmlChar * URI, 
xsltExtInitFunction initFunc,
xsltExtShutdownFunction shutdownFunc,
xsltStyleExtInitFunction styleInitFunc,
xsltStyleExtShutdownFunction styleShutdownFunc)

Register an XSLT extension module to the library.

URI:URI associated to this module
initFunc:the module initialization function
shutdownFunc:the module shutdown function
styleInitFunc:the module initialization function
styleShutdownFunc:the module shutdown function
Returns:0 if sucessful, -1 in case of error


xsltRegisterExtModuleTopLevel ()

int	xsltRegisterExtModuleTopLevel	(const xmlChar * name, 
const xmlChar * URI,
xsltTopLevelFunction function)

Registers an extension module top-level element.

name:the top-level element name
URI:the top-level element namespace URI
function:the top-level element callback
Returns:0 if successful, -1 in case of error.

xsltRegisterExtPrefix ()

int	xsltRegisterExtPrefix		(xsltStylesheetPtr style, 
const xmlChar * prefix,
const xmlChar * URI)

Registers an extension namespace This is called from xslt.c during compile-time. The given prefix is not needed. Called by: xsltParseExtElemPrefixes() (new function) xsltRegisterExtPrefix() (old function)

style:an XSLT stylesheet
prefix:the prefix used (optional)
URI:the URI associated to the extension
Returns:0 in case of success, 1 if the @URI was already registered as an extension namespace and -1 in case of failure


xsltShutdownCtxtExts ()

void	xsltShutdownCtxtExts		(xsltTransformContextPtr ctxt)

Shutdown the set of modules loaded

ctxt:an XSLT transformation context

xsltShutdownExts ()

void	xsltShutdownExts		(xsltStylesheetPtr style)

Shutdown the set of modules loaded

style:an XSLT stylesheet

xsltStyleGetExtData ()

void *	xsltStyleGetExtData		(xsltStylesheetPtr style, 
const xmlChar * URI)

Retrieve the data associated to the extension module in this given stylesheet. Called by: xsltRegisterExtPrefix(), ( xsltExtElementPreCompTest(), xsltExtInitTest )

style:an XSLT stylesheet
URI:the URI associated to the exension module
Returns:the pointer or NULL if not present

xsltStyleStylesheetLevelGetExtData ()

void *	xsltStyleStylesheetLevelGetExtData	(xsltStylesheetPtr style, 
const xmlChar * URI)

Retrieve the data associated to the extension module in this given stylesheet.

style:an XSLT stylesheet
URI:the URI associated to the exension module
Returns:the pointer or NULL if not present





xsltXPathGetTransformContext ()

xsltTransformContextPtr	xsltXPathGetTransformContext	(xmlXPathParserContextPtr ctxt)

Provides the XSLT transformation context from the XPath transformation context. This is useful when an XPath function in the extension module is called by the XPath interpreter and that the XSLT context is needed for example to retrieve the associated data pertaining to this XSLT transformation.

ctxt:an XPath transformation context
Returns:the XSLT transformation context or NULL in case of error.