1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-05 23:35:48 +03:00

some more generated files to ignore utils.h not installed anymore changed

* libexslt/.cvsignore: some more generated files to ignore
        * libexslt/Makefile.am: utils.h not installed anymore
        * libexslt/common.c libexslt/exslt.[ch] libexslt/functions.c
          libexslt/math.c libexslt/sets.c:
          changed function prefix from exsl* to exslt*
          {common.c,exslt.c} moved exsltLib{rary,exslt,xslt,xml}Version
          from common.c to exslt.c
          {common.c} removed exslNodeSetFunction, uses xsltFunctionNodeSet
          instead
        * libxslt/extra.c: fixed xsltFunctionNodeSet to accept
          XPATH_NODESET arguments in addition to XPATH_XSLT_TREE
        * xsltproc/xsltproc.c: updated to use the new function prefix
This commit is contained in:
Thomas Broyer
2001-07-15 23:24:13 +00:00
parent 6ab14c960e
commit e98a65f34d
11 changed files with 217 additions and 214 deletions

View File

@@ -1,3 +1,18 @@
2001-07-16 Thomas Broyer <tbroyer@ltgt.net>
* libexslt/.cvsignore: some more generated files to ignore
* libexslt/Makefile.am: utils.h not installed anymore
* libexslt/common.c libexslt/exslt.[ch] libexslt/functions.c
libexslt/math.c libexslt/sets.c:
changed function prefix from exsl* to exslt*
{common.c,exslt.c} moved exsltLib{rary,exslt,xslt,xml}Version
from common.c to exslt.c
{common.c} removed exslNodeSetFunction, uses xsltFunctionNodeSet
instead
* libxslt/extra.c: fixed xsltFunctionNodeSet to accept
XPATH_NODESET arguments in addition to XPATH_XSLT_TREE
* xsltproc/xsltproc.c: updated to use the new function prefix
2001-07-15 Darin Adler <darin@bentspoon.com> 2001-07-15 Darin Adler <darin@bentspoon.com>
* libxslt/.cvsignore: * libxslt/.cvsignore:

View File

@@ -12,4 +12,7 @@ sets.o
functions.lo functions.lo
functions.o functions.o
utils.lo utils.lo
utils.o utils.o
.deps
.libs
exsltconfig.h

View File

@@ -7,7 +7,6 @@ exsltincdir = $(includedir)/libexslt
exsltinc_HEADERS = \ exsltinc_HEADERS = \
exslt.h \ exslt.h \
utils.h \
exsltconfig.h exsltconfig.h
libexslt_la_SOURCES = \ libexslt_la_SOURCES = \

View File

@@ -1,47 +1,18 @@
#include <libxml/xmlversion.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/xpath.h> #include <libxml/xpath.h>
#include <libxml/xpathInternals.h> #include <libxml/xpathInternals.h>
#include <libxslt/xsltconfig.h>
#include <libxslt/xsltutils.h> #include <libxslt/xsltutils.h>
#include <libxslt/xsltInternals.h> #include <libxslt/xsltInternals.h>
#include <libxslt/extensions.h> #include <libxslt/extensions.h>
#include <libxslt/transform.h> #include <libxslt/transform.h>
#include <libxslt/extra.h>
#include "exsltconfig.h"
#include "exslt.h" #include "exslt.h"
#include "utils.h" #include "utils.h"
const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING;
const int exsltLibexsltVersion = LIBEXSLT_VERSION;
const int exsltLibxsltVersion = LIBXSLT_VERSION;
const int exsltLibxmlVersion = LIBXML_VERSION;
/**
* exslNodeSetFunction:
* @ctxt: an XPath parser context
*
* Implements the EXSLT - Common node-set function:
* node-set exsl:node-set (result-tree-fragment)
* for use by the XPath processor.
*/
static void static void
exslNodeSetFunction(xmlXPathParserContextPtr ctxt, int nargs){ exsltObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
if (nargs != 1) {
xmlXPathSetArityError(ctxt);
return;
}
if (!xmlXPathStackIsNodeSet(ctxt)) {
xmlXPathSetTypeError(ctxt);
return;
}
ctxt->value->type = XPATH_NODESET;
ctxt->value->boolval = 1;
}
static void
exslObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr obj, ret; xmlXPathObjectPtr obj, ret;
if (nargs != 1) { if (nargs != 1) {
@@ -83,11 +54,11 @@ exslObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
static void * static void *
exslCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { exsltCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
xsltRegisterExtFunction (ctxt, (const xmlChar *) "node-set", xsltRegisterExtFunction (ctxt, (const xmlChar *) "node-set",
URI, exslNodeSetFunction); URI, xsltFunctionNodeSet);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "object-type", xsltRegisterExtFunction (ctxt, (const xmlChar *) "object-type",
URI, exslObjectTypeFunction); URI, exsltObjectTypeFunction);
xsltRegisterExtElement (ctxt, (const xmlChar *) "document", xsltRegisterExtElement (ctxt, (const xmlChar *) "document",
URI, xsltDocumentElem); URI, xsltDocumentElem);
@@ -96,13 +67,13 @@ exslCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
} }
/** /**
* exslCommonRegister: * exsltCommonRegister:
* *
* Registers the EXSLT - Common module * Registers the EXSLT - Common module
*/ */
void void
exslCommonRegister (void) { exsltCommonRegister (void) {
xsltRegisterExtModule (EXSLT_COMMON_NAMESPACE, xsltRegisterExtModule (EXSLT_COMMON_NAMESPACE,
exslCommonInit, NULL); exsltCommonInit, NULL);
} }

View File

@@ -1,18 +1,26 @@
#include <libxml/xmlversion.h>
#include <libxslt/xsltconfig.h>
#include <libxslt/extensions.h> #include <libxslt/extensions.h>
#include "exsltconfig.h"
#include "exslt.h" #include "exslt.h"
const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING;
const int exsltLibexsltVersion = LIBEXSLT_VERSION;
const int exsltLibxsltVersion = LIBXSLT_VERSION;
const int exsltLibxmlVersion = LIBXML_VERSION;
/** /**
* exslRegisterAll: * exsltRegisterAll:
* *
* Registers all available EXSLT extensions * Registers all available EXSLT extensions
*/ */
void void
exslRegisterAll (void) { exsltRegisterAll (void) {
exslCommonRegister(); exsltCommonRegister();
exslMathRegister(); exsltMathRegister();
exslSetsRegister(); exsltSetsRegister();
exslFuncRegister(); exsltFuncRegister();
} }

View File

@@ -14,12 +14,12 @@ extern const int exsltLibxmlVersion;
#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets") #define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets")
#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions") #define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions")
void exslCommonRegister (void); void exsltCommonRegister (void);
void exslMathRegister (void); void exsltMathRegister (void);
void exslSetsRegister (void); void exsltSetsRegister (void);
void exslFuncRegister (void); void exsltFuncRegister (void);
void exslRegisterAll (void); void exsltRegisterAll (void);
#endif /* __EXSLT_H__ */ #endif /* __EXSLT_H__ */

View File

@@ -11,26 +11,28 @@
#include "exslt.h" #include "exslt.h"
#include "utils.h" #include "utils.h"
typedef struct _exslFuncFunctionData exslFuncFunctionData; typedef struct _exsltFuncFunctionData exsltFuncFunctionData;
struct _exslFuncFunctionData { struct _exsltFuncFunctionData {
int nargs; int nargs;
xmlNodePtr content; xmlNodePtr content;
}; };
typedef struct _exslFuncData exslFuncData; typedef struct _exsltFuncData exsltFuncData;
struct _exslFuncData { struct _exsltFuncData {
xmlHashTablePtr funcs; xmlHashTablePtr funcs;
xmlXPathObjectPtr result; xmlXPathObjectPtr result;
int error; int error;
}; };
void exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node, static void exsltFuncFunctionElem (xsltTransformContextPtr ctxt,
xmlNodePtr inst, xsltStylePreCompPtr comp); xmlNodePtr node, xmlNodePtr inst,
void exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node, xsltStylePreCompPtr comp);
xmlNodePtr inst, xsltStylePreCompPtr comp); static void exsltFuncResultElem (xsltTransformContextPtr ctxt,
xmlNodePtr node, xmlNodePtr inst,
xsltStylePreCompPtr comp);
/** /**
* exslFuncInit: * exsltFuncInit:
* @ctxt: an XSLT transformation context * @ctxt: an XSLT transformation context
* @URI: the namespace URI for the extension * @URI: the namespace URI for the extension
* *
@@ -38,43 +40,43 @@ void exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
* *
* Returns the data for this transformation * Returns the data for this transformation
*/ */
static exslFuncData * static exsltFuncData *
exslFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
exslFuncData *ret; exsltFuncData *ret;
ret = (exslFuncData *) xmlMalloc (sizeof(exslFuncData)); ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData));
if (ret == NULL) { if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exslFuncInit: not enough memory\n"); "exsltFuncInit: not enough memory\n");
return(NULL); return(NULL);
} }
memset(ret, 0, sizeof(exsltFuncData));
ret->funcs = xmlHashCreate(1); ret->funcs = xmlHashCreate(1);
ret->result = NULL; ret->result = NULL;
ret->error = 0; ret->error = 0;
xsltRegisterExtElement (ctxt, (const xmlChar *) "function", xsltRegisterExtElement (ctxt, (const xmlChar *) "function",
URI, exslFuncFunctionElem); URI, exsltFuncFunctionElem);
xsltRegisterExtElement (ctxt, (const xmlChar *) "result", xsltRegisterExtElement (ctxt, (const xmlChar *) "result",
URI, exslFuncResultElem); URI, exsltFuncResultElem);
return(ret); return(ret);
} }
/** /**
* exslFuncShutdown: * exsltFuncShutdown:
* @ctxt: an XSLT transformation context * @ctxt: an XSLT transformation context
* @URI: the namespace URI fir the extension * @URI: the namespace URI fir the extension
* @data: the module data to free up * @data: the module data to free up
* *
* Shutdown the EXSLT - Functions module * Shutdown the EXSLT - Functions module
*/ */
static static void static void
exslFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
const xmlChar *URI ATTRIBUTE_UNUSED, const xmlChar *URI ATTRIBUTE_UNUSED,
exslFuncData *data) { exsltFuncData *data) {
if (data->funcs != NULL) if (data->funcs != NULL)
xmlHashFree(data->funcs, (xmlHashDeallocator) xmlFree); xmlHashFree(data->funcs, (xmlHashDeallocator) xmlFree);
if (data->result != NULL) if (data->result != NULL)
@@ -83,52 +85,53 @@ exslFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
} }
/** /**
* exslFuncRegister: * exsltFuncRegister:
* *
* Registers the EXSLT - Functions module * Registers the EXSLT - Functions module
*/ */
void void
exslFuncRegister (void) { exsltFuncRegister (void) {
xsltRegisterExtModule (EXSLT_FUNCTIONS_NAMESPACE, xsltRegisterExtModule (EXSLT_FUNCTIONS_NAMESPACE,
(xsltExtInitFunction) exslFuncInit, (xsltExtInitFunction) exsltFuncInit,
(xsltExtShutdownFunction) exslFuncShutdown); (xsltExtShutdownFunction) exsltFuncShutdown);
} }
/** /**
* exslFuncNewFunctionData: * exsltFuncNewFunctionData:
* *
* Allocates an #exslFuncFunctionData object * Allocates an #exslFuncFunctionData object
* *
* Returns the new structure * Returns the new structure
*/ */
static exslFuncFunctionData * static exsltFuncFunctionData *
exslFuncNewFunctionData (void) { exsltFuncNewFunctionData (void) {
exslFuncFunctionData *ret; exsltFuncFunctionData *ret;
ret = (exslFuncFunctionData *) xmlMalloc (sizeof(exslFuncFunctionData)); ret = (exsltFuncFunctionData *) xmlMalloc (sizeof(exsltFuncFunctionData));
if (ret == NULL) { if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exslFuncNewFunctionData: not enough memory\n"); "exsltFuncNewFunctionData: not enough memory\n");
return (NULL); return (NULL);
} }
ret->nargs = 0; ret->nargs = 0;
ret->content = NULL; ret->content = NULL;
return(ret); return(ret);
} }
/** /**
* exslFuncFunctionFunction: * exsltFuncFunctionFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Evaluates the func:function element defining the called function. * Evaluates the func:function element defining the called function.
*/ */
static void static void
exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr obj, oldResult, ret; xmlXPathObjectPtr obj, oldResult, ret;
exslFuncData *data; exsltFuncData *data;
exslFuncFunctionData *func; exsltFuncFunctionData *func;
xmlNodePtr paramNode, oldInsert, fake; xmlNodePtr paramNode, oldInsert, fake;
xsltStackElemPtr params = NULL, param; xsltStackElemPtr params = NULL, param;
xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt); xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
@@ -137,14 +140,14 @@ exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
/* /*
* retrieve func:function template * retrieve func:function template
*/ */
data = (exslFuncData *) xsltGetExtData (tctxt, data = (exsltFuncData *) xsltGetExtData (tctxt,
EXSLT_FUNCTIONS_NAMESPACE); EXSLT_FUNCTIONS_NAMESPACE);
oldResult = data->result; oldResult = data->result;
data->result = NULL; data->result = NULL;
func = (exslFuncFunctionData*) xmlHashLookup2 (data->funcs, func = (exsltFuncFunctionData*) xmlHashLookup2 (data->funcs,
ctxt->context->functionURI, ctxt->context->functionURI,
ctxt->context->function); ctxt->context->function);
/* /*
* params handling * params handling
@@ -222,13 +225,13 @@ exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
valuePush(ctxt, ret); valuePush(ctxt, ret);
} }
void static void
exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node, exsltFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlNodePtr inst, xsltStylePreCompPtr comp) { xmlNodePtr inst, xsltStylePreCompPtr comp) {
xmlChar *name, *prefix; xmlChar *name, *prefix;
xmlNsPtr ns; xmlNsPtr ns;
exslFuncData *data; exsltFuncData *data;
exslFuncFunctionData *func; exsltFuncFunctionData *func;
xsltStylePreCompPtr param_comp; xsltStylePreCompPtr param_comp;
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL)) if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
@@ -263,7 +266,7 @@ exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
/* /*
* Create function data * Create function data
*/ */
func = exslFuncNewFunctionData(); func = exsltFuncNewFunctionData();
func->content = inst->children; func->content = inst->children;
param_comp = (xsltStylePreCompPtr) func->content->_private; param_comp = (xsltStylePreCompPtr) func->content->_private;
while ((param_comp != NULL) && (param_comp->type == XSLT_FUNC_PARAM)) { while ((param_comp != NULL) && (param_comp->type == XSLT_FUNC_PARAM)) {
@@ -276,7 +279,7 @@ exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
* Register the function data such that it can be retrieved * Register the function data such that it can be retrieved
* by exslFuncFunctionFunction * by exslFuncFunctionFunction
*/ */
data = (exslFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE); data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
xmlHashAddEntry2 (data->funcs, ns->href, name, func); xmlHashAddEntry2 (data->funcs, ns->href, name, func);
/* /*
@@ -284,17 +287,17 @@ exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
* expressions. * expressions.
*/ */
xsltRegisterExtFunction (ctxt, name, ns->href, xsltRegisterExtFunction (ctxt, name, ns->href,
exslFuncFunctionFunction); exsltFuncFunctionFunction);
xmlFree(name); xmlFree(name);
} }
void static void
exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node, exsltFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlNodePtr inst, xsltStylePreCompPtr comp) { xmlNodePtr inst, xsltStylePreCompPtr comp) {
xmlNodePtr test; xmlNodePtr test;
xmlChar *select; xmlChar *select;
exslFuncData *data; exsltFuncData *data;
xmlXPathObjectPtr ret; xmlXPathObjectPtr ret;
/* /*
@@ -309,7 +312,7 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback")) if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback"))
continue; continue;
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exslFuncResultElem: only xsl:fallback is " "exsltFuncResultElem: only xsl:fallback is "
"allowed to follow func:result\n"); "allowed to follow func:result\n");
return; return;
} }
@@ -347,10 +350,10 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
* func:function element results in the instantiation of more than * func:function element results in the instantiation of more than
* one func:result elements. * one func:result elements.
*/ */
data = (exslFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE); data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
if (data == NULL) { if (data == NULL) {
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exslFuncReturnElem: data == NULL\n"); "exsltFuncReturnElem: data == NULL\n");
return; return;
} }
if (data->result != NULL) { if (data->result != NULL) {
@@ -380,7 +383,7 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
ret = xmlXPathEvalExpression(select, ctxt->xpathCtxt); ret = xmlXPathEvalExpression(select, ctxt->xpathCtxt);
if (ret == NULL) { if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exslFuncResultElem: ret == NULL\n"); "exsltFuncResultElem: ret == NULL\n");
return; return;
} }
} else if (test->children != NULL) { } else if (test->children != NULL) {
@@ -402,7 +405,7 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
ret = xmlXPathNewValueTree(container); ret = xmlXPathNewValueTree(container);
if (ret == NULL) { if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"exslFuncResultElem: ret == NULL\n"); "exsltFuncResultElem: ret == NULL\n");
data->error = 1; data->error = 1;
} }
} else { } else {

View File

@@ -13,7 +13,7 @@
extern double xmlXPathNAN; extern double xmlXPathNAN;
/** /**
* exslMathMin: * exsltMathMin:
* @ns: a node-set * @ns: a node-set
* *
* Implements the EXSLT - Math min() function: * Implements the EXSLT - Math min() function:
@@ -24,7 +24,7 @@ extern double xmlXPathNAN;
* turns into NaN. * turns into NaN.
*/ */
static double static double
exslMathMin (xmlNodeSetPtr ns) { exsltMathMin (xmlNodeSetPtr ns) {
double ret, cur; double ret, cur;
int i; int i;
@@ -44,14 +44,14 @@ exslMathMin (xmlNodeSetPtr ns) {
} }
/** /**
* exslMathMinFunction: * exsltMathMinFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslMathMin for use by the XPath processor. * Wraps #exsltMathMin for use by the XPath processor.
*/ */
static void static void
exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns; xmlNodeSetPtr ns;
double ret; double ret;
@@ -65,7 +65,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
if (xmlXPathCheckError(ctxt)) if (xmlXPathCheckError(ctxt))
return; return;
ret = exslMathMin(ns); ret = exsltMathMin(ns);
xmlXPathFreeNodeSet(ns); xmlXPathFreeNodeSet(ns);
@@ -74,7 +74,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
/** /**
* exslMathMax: * exsltMathMax:
* @ns: a node-set * @ns: a node-set
* *
* Implements the EXSLT - Math max() function: * Implements the EXSLT - Math max() function:
@@ -85,7 +85,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* turns into NaN. * turns into NaN.
*/ */
static double static double
exslMathMax (xmlNodeSetPtr ns) { exsltMathMax (xmlNodeSetPtr ns) {
double ret, cur; double ret, cur;
int i; int i;
@@ -105,14 +105,14 @@ exslMathMax (xmlNodeSetPtr ns) {
} }
/** /**
* exslMathMaxFunction: * exsltMathMaxFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslMathMax for use by the XPath processor. * Wraps #exsltMathMax for use by the XPath processor.
*/ */
static void static void
exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns; xmlNodeSetPtr ns;
double ret; double ret;
@@ -124,7 +124,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
if (xmlXPathCheckError(ctxt)) if (xmlXPathCheckError(ctxt))
return; return;
ret = exslMathMax(ns); ret = exsltMathMax(ns);
xmlXPathFreeNodeSet(ns); xmlXPathFreeNodeSet(ns);
@@ -132,7 +132,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
/** /**
* exslMathHighest: * exsltMathHighest:
* @ns: a node-set * @ns: a node-set
* *
* Implements the EXSLT - Math highest() function: * Implements the EXSLT - Math highest() function:
@@ -142,7 +142,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* for the node-set. * for the node-set.
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslMathHighest (xmlNodeSetPtr ns) { exsltMathHighest (xmlNodeSetPtr ns) {
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
double max, cur; double max, cur;
int i; int i;
@@ -176,14 +176,14 @@ exslMathHighest (xmlNodeSetPtr ns) {
} }
/** /**
* exslMathHighestFunction: * exsltMathHighestFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslMathHighest for use by the XPath processor * Wraps #exsltMathHighest for use by the XPath processor
*/ */
static void static void
exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns, ret; xmlNodeSetPtr ns, ret;
if (nargs != 1) { if (nargs != 1) {
@@ -195,7 +195,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
if (xmlXPathCheckError(ctxt)) if (xmlXPathCheckError(ctxt))
return; return;
ret = exslMathHighest(ns); ret = exsltMathHighest(ns);
xmlXPathFreeNodeSet(ns); xmlXPathFreeNodeSet(ns);
@@ -203,7 +203,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
/** /**
* exslMathLowest: * exsltMathLowest:
* @ns: a node-set * @ns: a node-set
* *
* Implements the EXSLT - Math lowest() function * Implements the EXSLT - Math lowest() function
@@ -213,7 +213,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* for the node-set. * for the node-set.
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslMathLowest (xmlNodeSetPtr ns) { exsltMathLowest (xmlNodeSetPtr ns) {
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
double min, cur; double min, cur;
int i; int i;
@@ -247,14 +247,14 @@ exslMathLowest (xmlNodeSetPtr ns) {
} }
/** /**
* exslMathLowestFunction: * exsltMathLowestFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslMathLowest for use by the XPath processor * Wraps #exsltMathLowest for use by the XPath processor
*/ */
static void static void
exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns, ret; xmlNodeSetPtr ns, ret;
if (nargs != 1) { if (nargs != 1) {
@@ -266,7 +266,7 @@ exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
if (xmlXPathCheckError(ctxt)) if (xmlXPathCheckError(ctxt))
return; return;
ret = exslMathLowest(ns); ret = exsltMathLowest(ns);
xmlXPathFreeNodeSet(ns); xmlXPathFreeNodeSet(ns);
@@ -274,25 +274,25 @@ exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
static void * static void *
exslMathInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { exsltMathInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
xsltRegisterExtFunction (ctxt, (const xmlChar *) "min", xsltRegisterExtFunction (ctxt, (const xmlChar *) "min",
URI, exslMathMinFunction); URI, exsltMathMinFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "max", xsltRegisterExtFunction (ctxt, (const xmlChar *) "max",
URI, exslMathMaxFunction); URI, exsltMathMaxFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "highest", xsltRegisterExtFunction (ctxt, (const xmlChar *) "highest",
URI, exslMathHighestFunction); URI, exsltMathHighestFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "lowest", xsltRegisterExtFunction (ctxt, (const xmlChar *) "lowest",
URI, exslMathLowestFunction); URI, exsltMathLowestFunction);
return(NULL); return(NULL);
} }
/** /**
* exslMathRegister: * exsltMathRegister:
* *
* Registers the EXSLT - Math module * Registers the EXSLT - Math module
*/ */
void void
exslMathRegister (void) { exsltMathRegister (void) {
xsltRegisterExtModule (EXSLT_MATH_NAMESPACE, exslMathInit, NULL); xsltRegisterExtModule (EXSLT_MATH_NAMESPACE, exsltMathInit, NULL);
} }

View File

@@ -10,7 +10,7 @@
#include "utils.h" #include "utils.h"
/** /**
* exslSetsDifference: * exsltSetsDifference:
* @nodes1: a node-set * @nodes1: a node-set
* @nodes2: a node-set * @nodes2: a node-set
* *
@@ -21,7 +21,7 @@
* nodes2 is empty * nodes2 is empty
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
xmlNodeSetPtr ret; xmlNodeSetPtr ret;
int i, l1; int i, l1;
xmlNodePtr cur; xmlNodePtr cur;
@@ -44,14 +44,14 @@ exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
} }
/** /**
* exslSetsDifferenceFunction: * exsltSetsDifferenceFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslSetsDifference for use by the XPath processor * Wraps #exsltSetsDifference for use by the XPath processor
*/ */
static void static void
exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr arg1, arg2, ret; xmlNodeSetPtr arg1, arg2, ret;
if (nargs != 2) { if (nargs != 2) {
@@ -71,7 +71,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
return; return;
} }
ret = exslSetsDifference(arg1, arg2); ret = exsltSetsDifference(arg1, arg2);
if (ret != arg1) if (ret != arg1)
xmlXPathFreeNodeSet(arg1); xmlXPathFreeNodeSet(arg1);
@@ -81,7 +81,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
/** /**
* exslSetsIntersection: * exsltSetsIntersection:
* @nodes1: a node-set * @nodes1: a node-set
* @nodes2: a node-set * @nodes2: a node-set
* *
@@ -92,7 +92,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* node sets passed as arguments * node sets passed as arguments
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
int i, l1; int i, l1;
xmlNodePtr cur; xmlNodePtr cur;
@@ -113,14 +113,14 @@ exslSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
} }
/** /**
* exslSetsIntersectionFunction: * exsltSetsIntersectionFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslSetsIntersection for use by the XPath processor * Wraps #exsltSetsIntersection for use by the XPath processor
*/ */
static void static void
exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr arg1, arg2, ret; xmlNodeSetPtr arg1, arg2, ret;
if (nargs != 2) { if (nargs != 2) {
@@ -140,7 +140,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
return; return;
} }
ret = exslSetsIntersection(arg1, arg2); ret = exsltSetsIntersection(arg1, arg2);
xmlXPathFreeNodeSet(arg1); xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2); xmlXPathFreeNodeSet(arg2);
@@ -149,7 +149,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
/** /**
* exslSetsDistinctSorted: * exsltSetsDistinctSorted:
* @nodes: a node-set, sorted by document order * @nodes: a node-set, sorted by document order
* *
* Implements the EXSLT - Sets distinct() function: * Implements the EXSLT - Sets distinct() function:
@@ -159,7 +159,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* it is empty * it is empty
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslSetsDistinctSorted (xmlNodeSetPtr nodes) { exsltSetsDistinctSorted (xmlNodeSetPtr nodes) {
xmlNodeSetPtr ret; xmlNodeSetPtr ret;
xmlHashTablePtr hash; xmlHashTablePtr hash;
int i, l; int i, l;
@@ -187,7 +187,7 @@ exslSetsDistinctSorted (xmlNodeSetPtr nodes) {
} }
/** /**
* exslSetsDistinct: * exsltSetsDistinct:
* @nodes: a node-set * @nodes: a node-set
* *
* Implements the EXSLT - Sets distinct() function: * Implements the EXSLT - Sets distinct() function:
@@ -199,23 +199,23 @@ exslSetsDistinctSorted (xmlNodeSetPtr nodes) {
* it is empty * it is empty
*/ */
xmlNodeSetPtr xmlNodeSetPtr
exslSetsDistinct (xmlNodeSetPtr nodes) { exsltSetsDistinct (xmlNodeSetPtr nodes) {
if (xmlXPathNodeSetIsEmpty(nodes)) if (xmlXPathNodeSetIsEmpty(nodes))
return(nodes); return(nodes);
xmlXPathNodeSetSort(nodes); xmlXPathNodeSetSort(nodes);
return(exslSetsDistinctSorted(nodes)); return(exsltSetsDistinctSorted(nodes));
} }
/** /**
* exslSetsDistinctFunction: * exsltSetsDistinctFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslSetsDistinct for use by the XPath processor * Wraps #exsltSetsDistinct for use by the XPath processor
*/ */
static void static void
exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr ns, ret; xmlNodeSetPtr ns, ret;
if (nargs != 1) { if (nargs != 1) {
@@ -228,7 +228,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
return; return;
/* !!! must be sorted !!! */ /* !!! must be sorted !!! */
ret = exslSetsDistinctSorted(ns); ret = exsltSetsDistinctSorted(ns);
xmlXPathFreeNodeSet(ns); xmlXPathFreeNodeSet(ns);
@@ -236,7 +236,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
/** /**
* exslSetsHasSameNodes: * exsltSetsHasSameNodes:
* @nodes1: a node-set * @nodes1: a node-set
* @nodes2: a node-set * @nodes2: a node-set
* *
@@ -247,7 +247,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* otherwise * otherwise
*/ */
static int static int
exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
int i, l; int i, l;
xmlNodePtr cur; xmlNodePtr cur;
@@ -265,14 +265,14 @@ exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
} }
/** /**
* exslSetsHasSameNodesFunction: * exsltSetsHasSameNodesFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslSetsHasSameNodes for use by the XPath processor * Wraps #exsltSetsHasSameNodes for use by the XPath processor
*/ */
static void static void
exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt, exsltSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
int nargs) { int nargs) {
xmlNodeSetPtr arg1, arg2; xmlNodeSetPtr arg1, arg2;
int ret; int ret;
@@ -294,7 +294,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
return; return;
} }
ret = exslSetsHasSameNodes(arg1, arg2); ret = exsltSetsHasSameNodes(arg1, arg2);
xmlXPathFreeNodeSet(arg1); xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2); xmlXPathFreeNodeSet(arg2);
@@ -303,7 +303,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
} }
/** /**
* exslSetsNodeLeadingSorted: * exsltSetsNodeLeadingSorted:
* @nodes: a node-set, sorted by document order * @nodes: a node-set, sorted by document order
* @node: a node * @node: a node
* *
@@ -315,7 +315,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
* doesn't contain @node * doesn't contain @node
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { exsltSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
int i, l; int i, l;
xmlNodePtr cur; xmlNodePtr cur;
xmlNodeSetPtr ret; xmlNodeSetPtr ret;
@@ -339,7 +339,7 @@ exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
} }
/** /**
* exslSetsNodeLeading: * exsltSetsNodeLeading:
* @nodes: a node-set * @nodes: a node-set
* @node: a node * @node: a node
* *
@@ -353,13 +353,13 @@ exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
* doesn't contain @node * doesn't contain @node
*/ */
xmlNodeSetPtr xmlNodeSetPtr
exslSetsNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) { exsltSetsNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) {
xmlXPathNodeSetSort(nodes); xmlXPathNodeSetSort(nodes);
return(exslSetsNodeLeadingSorted(nodes, node)); return(exsltSetsNodeLeadingSorted(nodes, node));
} }
/** /**
* exslSetsLeadingSorted: * exsltSetsLeadingSorted:
* @nodes1: a node-set, sorted by document order * @nodes1: a node-set, sorted by document order
* @nodes2: a node-set, sorted by document order * @nodes2: a node-set, sorted by document order
* *
@@ -371,15 +371,15 @@ exslSetsNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) {
* an empty node-set if @nodes1 doesn't contain @nodes2 * an empty node-set if @nodes1 doesn't contain @nodes2
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslSetsLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
if (xmlXPathNodeSetIsEmpty(nodes2)) if (xmlXPathNodeSetIsEmpty(nodes2))
return(nodes1); return(nodes1);
return(exslSetsNodeLeadingSorted(nodes1, return(exsltSetsNodeLeadingSorted(nodes1,
xmlXPathNodeSetItem(nodes2, 1))); xmlXPathNodeSetItem(nodes2, 1)));
} }
/** /**
* exslSetsLeading: * exsltSetsLeading:
* @nodes1: a node-set * @nodes1: a node-set
* @nodes2: a node-set * @nodes2: a node-set
* *
@@ -393,26 +393,26 @@ exslSetsLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
* an empty node-set if @nodes1 doesn't contain @nodes2 * an empty node-set if @nodes1 doesn't contain @nodes2
*/ */
xmlNodeSetPtr xmlNodeSetPtr
exslSetsLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
if (xmlXPathNodeSetIsEmpty(nodes2)) if (xmlXPathNodeSetIsEmpty(nodes2))
return(nodes1); return(nodes1);
if (xmlXPathNodeSetIsEmpty(nodes1)) if (xmlXPathNodeSetIsEmpty(nodes1))
return(xmlXPathNodeSetCreate(NULL)); return(xmlXPathNodeSetCreate(NULL));
xmlXPathNodeSetSort(nodes1); xmlXPathNodeSetSort(nodes1);
xmlXPathNodeSetSort(nodes2); xmlXPathNodeSetSort(nodes2);
return(exslSetsNodeLeadingSorted(nodes1, return(exsltSetsNodeLeadingSorted(nodes1,
xmlXPathNodeSetItem(nodes2, 1))); xmlXPathNodeSetItem(nodes2, 1)));
} }
/** /**
* exslSetsLeadingFunction: * exsltSetsLeadingFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslSetsLeading for use by the XPath processor * Wraps #exsltSetsLeading for use by the XPath processor
*/ */
static void static void
exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr arg1, arg2, ret; xmlNodeSetPtr arg1, arg2, ret;
if (nargs != 2) { if (nargs != 2) {
@@ -432,7 +432,8 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
return; return;
} }
ret = exslSetsLeadingSorted(arg1, arg2); /* !!! must be sorted */
ret = exsltSetsLeadingSorted(arg1, arg2);
xmlXPathFreeNodeSet(arg1); xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2); xmlXPathFreeNodeSet(arg2);
@@ -441,7 +442,7 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
/** /**
* exslSetsNodeTrailingSorted: * exsltSetsNodeTrailingSorted:
* @nodes: a node-set, sorted by document order * @nodes: a node-set, sorted by document order
* @node: a node * @node: a node
* *
@@ -453,7 +454,7 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
* doesn't contain @node * doesn't contain @node
*/ */
static xmlNodeSetPtr static xmlNodeSetPtr
exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { exsltSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
int i, l; int i, l;
xmlNodePtr cur; xmlNodePtr cur;
xmlNodeSetPtr ret; xmlNodeSetPtr ret;
@@ -477,13 +478,13 @@ exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
} }
/** /**
* exslSetsNodeTrailing: * exsltSetsNodeTrailing:
* @nodes: a node-set * @nodes: a node-set
* @node: a node * @node: a node
* *
* Implements the EXSLT - Sets trailing() function: * Implements the EXSLT - Sets trailing() function:
* node-set set:trailing (node-set, node-set) * node-set set:trailing (node-set, node-set)
* @nodes is sorted by document order, then #exslSetsNodeLeadingSorted * @nodes is sorted by document order, then #exsltSetsNodeTrailingSorted
* is called. * is called.
* *
* Returns the nodes in @nodes that follow @node in document order, * Returns the nodes in @nodes that follow @node in document order,
@@ -491,13 +492,13 @@ exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
* doesn't contain @node * doesn't contain @node
*/ */
xmlNodeSetPtr xmlNodeSetPtr
exslSetsNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node) { exsltSetsNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node) {
xmlXPathNodeSetSort(nodes); xmlXPathNodeSetSort(nodes);
return(exslSetsNodeTrailingSorted(nodes, node)); return(exsltSetsNodeTrailingSorted(nodes, node));
} }
/** /**
* exslSetsTrailingSorted: * exsltSetsTrailingSorted:
* @nodes1: a node-set, sorted by document order * @nodes1: a node-set, sorted by document order
* @nodes2: a node-set, sorted by document order * @nodes2: a node-set, sorted by document order
* *
@@ -509,48 +510,48 @@ exslSetsNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node) {
* an empty node-set if @nodes1 doesn't contain @nodes2 * an empty node-set if @nodes1 doesn't contain @nodes2
*/ */
xmlNodeSetPtr xmlNodeSetPtr
exslSetsTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
if (xmlXPathNodeSetIsEmpty(nodes2)) if (xmlXPathNodeSetIsEmpty(nodes2))
return(nodes1); return(nodes1);
return(exslSetsNodeTrailingSorted(nodes1, return(exsltSetsNodeTrailingSorted(nodes1,
xmlXPathNodeSetItem(nodes2, 0))); xmlXPathNodeSetItem(nodes2, 0)));
} }
/** /**
* exslSetsTrailing: * exsltSetsTrailing:
* @nodes1: a node-set * @nodes1: a node-set
* @nodes2: a node-set * @nodes2: a node-set
* *
* Implements the EXSLT - Sets trailing() function: * Implements the EXSLT - Sets trailing() function:
* node-set set:trailing (node-set, node-set) * node-set set:trailing (node-set, node-set)
* @nodes1 and @nodes2 are sorted by document order, then * @nodes1 and @nodes2 are sorted by document order, then
* #exslSetsLeadingSorted is called. * #exsltSetsTrailingSorted is called.
* *
* Returns the nodes in @nodes1 that follow the first node in @nodes2 * Returns the nodes in @nodes1 that follow the first node in @nodes2
* in document order, @nodes1 if @nodes2 is NULL or empty or * in document order, @nodes1 if @nodes2 is NULL or empty or
* an empty node-set if @nodes1 doesn't contain @nodes2 * an empty node-set if @nodes1 doesn't contain @nodes2
*/ */
xmlNodeSetPtr xmlNodeSetPtr
exslSetsTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { exsltSetsTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
if (xmlXPathNodeSetIsEmpty(nodes2)) if (xmlXPathNodeSetIsEmpty(nodes2))
return(nodes1); return(nodes1);
if (xmlXPathNodeSetIsEmpty(nodes1)) if (xmlXPathNodeSetIsEmpty(nodes1))
return(xmlXPathNodeSetCreate(NULL)); return(xmlXPathNodeSetCreate(NULL));
xmlXPathNodeSetSort(nodes1); xmlXPathNodeSetSort(nodes1);
xmlXPathNodeSetSort(nodes2); xmlXPathNodeSetSort(nodes2);
return(exslSetsNodeTrailingSorted(nodes1, return(exsltSetsNodeTrailingSorted(nodes1,
xmlXPathNodeSetItem(nodes2, 0))); xmlXPathNodeSetItem(nodes2, 0)));
} }
/** /**
* exslSetsTrailingFunction: * exsltSetsTrailingFunction:
* @ctxt: an XPath parser context * @ctxt: an XPath parser context
* @nargs: the number of arguments * @nargs: the number of arguments
* *
* Wraps #exslSetsTrailing for use by the XPath processor * Wraps #exsltSetsTrailing for use by the XPath processor
*/ */
static void static void
exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) { exsltSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
xmlNodeSetPtr arg1, arg2, ret; xmlNodeSetPtr arg1, arg2, ret;
if (nargs != 2) { if (nargs != 2) {
@@ -570,7 +571,8 @@ exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
return; return;
} }
ret = exslSetsNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0)); /* !!! mist be sorted */
ret = exsltSetsNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
xmlXPathFreeNodeSet(arg1); xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2); xmlXPathFreeNodeSet(arg2);
@@ -579,30 +581,30 @@ exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
} }
static void * static void *
exslSetsInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { exsltSetsInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
xsltRegisterExtFunction (ctxt, (const xmlChar *) "difference", xsltRegisterExtFunction (ctxt, (const xmlChar *) "difference",
URI, exslSetsDifferenceFunction); URI, exsltSetsDifferenceFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "intersection", xsltRegisterExtFunction (ctxt, (const xmlChar *) "intersection",
URI, exslSetsIntersectionFunction); URI, exsltSetsIntersectionFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "distinct", xsltRegisterExtFunction (ctxt, (const xmlChar *) "distinct",
URI, exslSetsDistinctFunction); URI, exsltSetsDistinctFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "has-same-nodes", xsltRegisterExtFunction (ctxt, (const xmlChar *) "has-same-nodes",
URI, exslSetsHasSameNodesFunction); URI, exsltSetsHasSameNodesFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "leading", xsltRegisterExtFunction (ctxt, (const xmlChar *) "leading",
URI, exslSetsLeadingFunction); URI, exsltSetsLeadingFunction);
xsltRegisterExtFunction (ctxt, (const xmlChar *) "trailing", xsltRegisterExtFunction (ctxt, (const xmlChar *) "trailing",
URI, exslSetsTrailingFunction); URI, exsltSetsTrailingFunction);
return(NULL); return(NULL);
} }
/** /**
* exslCommonRegister: * exsltCommonRegister:
* *
* Registers the EXSLT - Sets module * Registers the EXSLT - Sets module
*/ */
void void
exslSetsRegister (void) { exsltSetsRegister (void) {
xsltRegisterExtModule (EXSLT_SETS_NAMESPACE, exslSetsInit, NULL); xsltRegisterExtModule (EXSLT_SETS_NAMESPACE, exsltSetsInit, NULL);
} }

View File

@@ -123,7 +123,9 @@ xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
ctxt->error = XPATH_INVALID_ARITY; ctxt->error = XPATH_INVALID_ARITY;
return; return;
} }
if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_XSLT_TREE)) { if ((ctxt->value == NULL) ||
((ctxt->value->type != XPATH_XSLT_TREE) &&
(ctxt->value->type != XPATH_NODESET))) {
xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL); xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL);
xsltGenericError(xsltGenericErrorContext, xsltGenericError(xsltGenericErrorContext,
"node-set() invalid arg expecting a result tree\n"); "node-set() invalid arg expecting a result tree\n");

View File

@@ -406,7 +406,7 @@ main(int argc, char **argv)
/* /*
* Register the EXSLT extensions * Register the EXSLT extensions
*/ */
exslRegisterAll(); exsltRegisterAll();
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if ((!strcmp(argv[i], "-maxdepth")) || if ((!strcmp(argv[i], "-maxdepth")) ||