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>
|
Wed Nov 27 13:33:26 CET 2002 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* libxslt/preproc.c libxslt/xsltInternals.h libxslt/xsltutils.c
|
* libxslt/preproc.c libxslt/xsltInternals.h libxslt/xsltutils.c
|
||||||
|
|||||||
@@ -148,6 +148,17 @@ typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt,
|
|||||||
xmlNodePtr inst,
|
xmlNodePtr inst,
|
||||||
xsltElemPreCompPtr comp);
|
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 {
|
typedef enum {
|
||||||
XSLT_FUNC_COPY=1,
|
XSLT_FUNC_COPY=1,
|
||||||
XSLT_FUNC_SORT,
|
XSLT_FUNC_SORT,
|
||||||
@@ -464,6 +475,8 @@ struct _xsltTransformContext {
|
|||||||
|
|
||||||
xmlGenericErrorFunc error; /* a specific error handler */
|
xmlGenericErrorFunc error; /* a specific error handler */
|
||||||
void * errctx; /* context for the 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
|
* reorder the current node list accordingly to the set of sorting
|
||||||
* requirement provided by the arry of nodes.
|
* requirement provided by the arry of nodes.
|
||||||
* This is a wrapper function, the actual function used can be overriden
|
* This is a wrapper function, the actual function used is specified
|
||||||
* using xsltSetSortFunc()
|
* 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
|
void
|
||||||
xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts,
|
xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts,
|
||||||
int nbsorts)
|
int nbsorts)
|
||||||
{
|
{
|
||||||
if (xsltSortFunction != NULL)
|
if (ctxt->sortfunc != NULL)
|
||||||
|
(ctxt->sortfunc)(ctxt, sorts, nbsorts);
|
||||||
|
else if (xsltSortFunction != NULL)
|
||||||
xsltSortFunction(ctxt, sorts, nbsorts);
|
xsltSortFunction(ctxt, sorts, nbsorts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,7 +986,8 @@ xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts,
|
|||||||
* xsltSetSortFunc:
|
* xsltSetSortFunc:
|
||||||
* @handler: the new handler function
|
* @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
|
void
|
||||||
xsltSetSortFunc(xsltSortFunc handler) {
|
xsltSetSortFunc(xsltSortFunc handler) {
|
||||||
@@ -991,6 +997,21 @@ xsltSetSortFunc(xsltSortFunc handler) {
|
|||||||
xsltSortFunction = xsltDefaultSortFunction;
|
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 *
|
* Output *
|
||||||
|
|||||||
@@ -84,17 +84,6 @@ extern "C" {
|
|||||||
((n)->type == XML_HTML_DOCUMENT_NODE)))
|
((n)->type == XML_HTML_DOCUMENT_NODE)))
|
||||||
#endif
|
#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.
|
* Our own version of namespaced atributes lookup.
|
||||||
*/
|
*/
|
||||||
@@ -137,6 +126,8 @@ void xsltTransformError (xsltTransformContextPtr ctxt,
|
|||||||
|
|
||||||
void xsltDocumentSortFunction (xmlNodeSetPtr list);
|
void xsltDocumentSortFunction (xmlNodeSetPtr list);
|
||||||
void xsltSetSortFunc (xsltSortFunc handler);
|
void xsltSetSortFunc (xsltSortFunc handler);
|
||||||
|
void xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
||||||
|
xsltSortFunc handler);
|
||||||
void xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
void xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
||||||
xmlNodePtr *sorts,
|
xmlNodePtr *sorts,
|
||||||
int nbsorts);
|
int nbsorts);
|
||||||
|
|||||||
@@ -314,7 +314,9 @@ EXPORTS
|
|||||||
/* Sorting. */
|
/* Sorting. */
|
||||||
xsltDocumentSortFunction
|
xsltDocumentSortFunction
|
||||||
xsltComputeSortResult
|
xsltComputeSortResult
|
||||||
|
xsltDoSortFunction
|
||||||
xsltSetSortFunc
|
xsltSetSortFunc
|
||||||
|
xsltSetCtxtSortFunc
|
||||||
|
|
||||||
/* QNames handling. */
|
/* QNames handling. */
|
||||||
xsltGetQNameURI
|
xsltGetQNameURI
|
||||||
|
|||||||
Reference in New Issue
Block a user