mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-11-04 00:53:12 +03:00
applied another patch from Richard Jinks for the export of teh sorting
* libxslt/xsltInternals.h libxslt/xsltutils.c libxslt/xsltutils.h win32/libxslt.def.src: applied another patch from Richard Jinks for the export of teh sorting routine and allowing per context sort. Daniel
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
Thu Nov 28 17:52:21 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* libxslt/xsltInternals.h libxslt/xsltutils.c libxslt/xsltutils.h
|
||||
win32/libxslt.def.src: applied another patch from Richard Jinks
|
||||
for the export of teh sorting routine and allowing per context
|
||||
sort.
|
||||
|
||||
Wed Nov 27 13:33:26 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* libxslt/preproc.c libxslt/xsltInternals.h libxslt/xsltutils.c
|
||||
|
||||
@@ -148,6 +148,17 @@ typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr inst,
|
||||
xsltElemPreCompPtr comp);
|
||||
|
||||
/**
|
||||
* xsltSortFunc:
|
||||
* @ctxt: a transformation context
|
||||
* @sorts: the node-set to sort
|
||||
* @nbsorts: the number of sorts
|
||||
*
|
||||
* Signature of the function to use during sorting
|
||||
*/
|
||||
typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
||||
int nbsorts);
|
||||
|
||||
typedef enum {
|
||||
XSLT_FUNC_COPY=1,
|
||||
XSLT_FUNC_SORT,
|
||||
@@ -464,6 +475,8 @@ struct _xsltTransformContext {
|
||||
|
||||
xmlGenericErrorFunc error; /* a specific error handler */
|
||||
void * errctx; /* context for the error handler */
|
||||
|
||||
xsltSortFunc sortfunc; /* a ctxt specific sort routine */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -966,14 +966,19 @@ static xsltSortFunc xsltSortFunction = xsltDefaultSortFunction;
|
||||
*
|
||||
* reorder the current node list accordingly to the set of sorting
|
||||
* requirement provided by the arry of nodes.
|
||||
* This is a wrapper function, the actual function used can be overriden
|
||||
* using xsltSetSortFunc()
|
||||
* This is a wrapper function, the actual function used is specified
|
||||
* using xsltSetCtxtSortFunc() to set the context specific sort function,
|
||||
* or xsltSetSortFunc() to set the global sort function.
|
||||
* If a sort function is set on the context, this will get called.
|
||||
* Otherwise the global sort function is called.
|
||||
*/
|
||||
void
|
||||
xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts,
|
||||
int nbsorts)
|
||||
{
|
||||
if (xsltSortFunction != NULL)
|
||||
if (ctxt->sortfunc != NULL)
|
||||
(ctxt->sortfunc)(ctxt, sorts, nbsorts);
|
||||
else if (xsltSortFunction != NULL)
|
||||
xsltSortFunction(ctxt, sorts, nbsorts);
|
||||
}
|
||||
|
||||
@@ -981,7 +986,8 @@ xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts,
|
||||
* xsltSetSortFunc:
|
||||
* @handler: the new handler function
|
||||
*
|
||||
* Function to reset the handler for XSLT sorting.
|
||||
* Function to reset the global handler for XSLT sorting.
|
||||
* If the handler is NULL, the default sort function will be used.
|
||||
*/
|
||||
void
|
||||
xsltSetSortFunc(xsltSortFunc handler) {
|
||||
@@ -991,6 +997,21 @@ xsltSetSortFunc(xsltSortFunc handler) {
|
||||
xsltSortFunction = xsltDefaultSortFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* xsltSetCtxtSortFunc:
|
||||
* @ctxt: a XSLT process context
|
||||
* @handler: the new handler function
|
||||
*
|
||||
* Function to set the handler for XSLT sorting
|
||||
* for the specified context.
|
||||
* If the handler is NULL, then the global
|
||||
* sort function will be called
|
||||
*/
|
||||
void
|
||||
xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) {
|
||||
ctxt->sortfunc = handler;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Output *
|
||||
|
||||
@@ -84,17 +84,6 @@ extern "C" {
|
||||
((n)->type == XML_HTML_DOCUMENT_NODE)))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xsltSortFunc:
|
||||
* @ctxt: a transformation context
|
||||
* @sorts: the node-set to sort
|
||||
* @nbsorts: the number of sorts
|
||||
*
|
||||
* Signature of the function to use during sorting
|
||||
*/
|
||||
typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
|
||||
int nbsorts);
|
||||
|
||||
/*
|
||||
* Our own version of namespaced atributes lookup.
|
||||
*/
|
||||
@@ -137,6 +126,8 @@ void xsltTransformError (xsltTransformContextPtr ctxt,
|
||||
|
||||
void xsltDocumentSortFunction (xmlNodeSetPtr list);
|
||||
void xsltSetSortFunc (xsltSortFunc handler);
|
||||
void xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
||||
xsltSortFunc handler);
|
||||
void xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr *sorts,
|
||||
int nbsorts);
|
||||
|
||||
@@ -314,7 +314,9 @@ EXPORTS
|
||||
/* Sorting. */
|
||||
xsltDocumentSortFunction
|
||||
xsltComputeSortResult
|
||||
xsltDoSortFunction
|
||||
xsltSetSortFunc
|
||||
xsltSetCtxtSortFunc
|
||||
|
||||
/* QNames handling. */
|
||||
xsltGetQNameURI
|
||||
|
||||
Reference in New Issue
Block a user