Module extensions from libxslt

# The XSLT C library for GNOME

## Module extensions from libxslt

API Menu

- Main Menu
- Developer Menu
- API Menu
- ChangeLog

Related links

- Mail archive
- XML libxml2
- FTP
- Windows binaries
- Solaris binaries
- MacOsX binaries
- Bug Tracker
- lxml Python bindings
- Perl XSLT bindings
- XSLT with PHP
- Apache module
- Pascal bindings
- Xsldbg Debugger

API Indexes

- Alphabetic
- Constructors
- Functions/Types
- Modules
- Symbols

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

## Table of Contents

    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)

    Function type: xsltExtInitFunction
    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)

    Function type: xsltExtShutdownFunction
    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)

    Function type: xsltPreComputeFunction
    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)

    Function type: xsltStyleExtInitFunction
    void *	xsltStyleExtInitFunction	(xsltStylesheetPtr style,
    					 const xmlChar * URI)

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

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

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

    Function type: xsltTopLevelFunction
    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

### Function: 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

### Function: 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

### Function: xsltDebugDumpExtensions

    void	xsltDebugDumpExtensions		(FILE * output)

Dumps a list of the registered XSLT extension functions and elements

`output`: | the FILE * for the output, if NULL stdout is used

### Function: 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

### Function type: xsltExtInitFunction

    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: 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.

### Function: 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.

### Function: xsltExtModuleFunctionLookup

    xmlXPathFunction	xsltExtModuleFunctionLookup	(const xmlChar * name,
    							 const xmlChar * URI)

Looks up an extension module function

`name`: | the function name
`URI`: | the function namespace URI
`Returns`: | the function if found, NULL otherwise.

### Function: 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.

### Function type: xsltExtShutdownFunction

    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: xsltFreeCtxtExts

    void	xsltFreeCtxtExts		(xsltTransformContextPtr ctxt)

Free the XSLT extension data

`ctxt`: | an XSLT transformation context

### Function: xsltFreeExts

    void	xsltFreeExts			(xsltStylesheetPtr style)

Free up the memory used by XSLT extensions in a stylesheet

`style`: | an XSLT stylesheet

### Function: 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

### Function: 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

### Function: 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

### Function: 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

### Function: xsltInitGlobals

    void	xsltInitGlobals			(void)

Initialize the global variables for extensions

### Function: 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

### Function: xsltPreComputeExtModuleElement

    xsltElemPreCompPtr	xsltPreComputeExtModuleElement	(xsltStylesheetPtr style,
    							 xmlNodePtr inst)

Precomputes an extension module element

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

### Function type: xsltPreComputeFunction

    Function type: xsltPreComputeFunction
    xsltElemPreCompPtr	xsltPreComputeFunction	(xsltStylesheetPtr style,
    						 xmlNodePtr inst,
    						 xsltTransformFunction function)

`style`: |
`inst`: |
`function`: |
`Returns`: |

### Function: 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

### Function: 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

### Function: 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

### Function: 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.

### Function: 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

### Function: xsltRegisterExtModuleFunction

    int	xsltRegisterExtModuleFunction	(const xmlChar * name,
    					 const xmlChar * URI,
    					 xmlXPathFunction function)

Registers an extension module function.

`name`: | the function name
`URI`: | the function namespace URI
`function`: | the function callback
`Returns`: | 0 if successful, -1 in case of error.

### Function: 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.

### Function: 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

### Function: xsltRegisterTestModule

    void	xsltRegisterTestModule		(void)

Registers the test module

### Function: xsltShutdownCtxtExts

    void	xsltShutdownCtxtExts		(xsltTransformContextPtr ctxt)

Shutdown the set of modules loaded

`ctxt`: | an XSLT transformation context

### Function: xsltShutdownExts

    void	xsltShutdownExts		(xsltStylesheetPtr style)

Shutdown the set of modules loaded

`style`: | an XSLT stylesheet

### Function type: xsltStyleExtInitFunction

    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

    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

### Function: 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

### Function: 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

### Function type: xsltTopLevelFunction

    Function type: xsltTopLevelFunction
    void	xsltTopLevelFunction		(xsltStylesheetPtr style,
    					 xmlNodePtr inst)

`style`: |
`inst`: |

### Function: xsltUnregisterExtModule

    int	xsltUnregisterExtModule		(const xmlChar * URI)

Unregister an XSLT extension module from the library.

`URI`: | URI associated to this module
`Returns`: | 0 if sucessful, -1 in case of error

### Function: xsltUnregisterExtModuleElement

    int	xsltUnregisterExtModuleElement	(const xmlChar * name,
    					 const xmlChar * URI)

Unregisters an extension module element

`name`: | the element name
`URI`: | the element namespace URI
`Returns`: | 0 if successful, -1 in case of error.

### Function: xsltUnregisterExtModuleFunction

    int	xsltUnregisterExtModuleFunction	(const xmlChar * name,
    					 const xmlChar * URI)

Unregisters an extension module function

`name`: | the function name
`URI`: | the function namespace URI
`Returns`: | 0 if successful, -1 in case of error.

### Function: xsltUnregisterExtModuleTopLevel

    int	xsltUnregisterExtModuleTopLevel	(const xmlChar * name,
    					 const xmlChar * URI)

Unregisters an extension module top-level element

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

### Function: 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.

Daniel Veillard