mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-07 10:42:55 +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:
15
ChangeLog
15
ChangeLog
@@ -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>
|
||||
|
||||
* libxslt/.cvsignore:
|
||||
|
@@ -13,3 +13,6 @@ functions.lo
|
||||
functions.o
|
||||
utils.lo
|
||||
utils.o
|
||||
.deps
|
||||
.libs
|
||||
exsltconfig.h
|
||||
|
@@ -7,7 +7,6 @@ exsltincdir = $(includedir)/libexslt
|
||||
|
||||
exsltinc_HEADERS = \
|
||||
exslt.h \
|
||||
utils.h \
|
||||
exsltconfig.h
|
||||
|
||||
libexslt_la_SOURCES = \
|
||||
|
@@ -1,47 +1,18 @@
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#include <libxslt/xsltconfig.h>
|
||||
#include <libxslt/xsltutils.h>
|
||||
#include <libxslt/xsltInternals.h>
|
||||
#include <libxslt/extensions.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <libxslt/extra.h>
|
||||
|
||||
#include "exsltconfig.h"
|
||||
#include "exslt.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
|
||||
exslNodeSetFunction(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) {
|
||||
exsltObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlXPathObjectPtr obj, ret;
|
||||
|
||||
if (nargs != 1) {
|
||||
@@ -83,11 +54,11 @@ exslObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
|
||||
|
||||
static void *
|
||||
exslCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
exsltCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "node-set",
|
||||
URI, exslNodeSetFunction);
|
||||
URI, xsltFunctionNodeSet);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "object-type",
|
||||
URI, exslObjectTypeFunction);
|
||||
URI, exsltObjectTypeFunction);
|
||||
|
||||
xsltRegisterExtElement (ctxt, (const xmlChar *) "document",
|
||||
URI, xsltDocumentElem);
|
||||
@@ -96,13 +67,13 @@ exslCommonInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslCommonRegister:
|
||||
* exsltCommonRegister:
|
||||
*
|
||||
* Registers the EXSLT - Common module
|
||||
*/
|
||||
|
||||
void
|
||||
exslCommonRegister (void) {
|
||||
exsltCommonRegister (void) {
|
||||
xsltRegisterExtModule (EXSLT_COMMON_NAMESPACE,
|
||||
exslCommonInit, NULL);
|
||||
exsltCommonInit, NULL);
|
||||
}
|
||||
|
@@ -1,18 +1,26 @@
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#include <libxslt/xsltconfig.h>
|
||||
#include <libxslt/extensions.h>
|
||||
|
||||
#include "exsltconfig.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
|
||||
*/
|
||||
void
|
||||
exslRegisterAll (void) {
|
||||
exslCommonRegister();
|
||||
exslMathRegister();
|
||||
exslSetsRegister();
|
||||
exslFuncRegister();
|
||||
exsltRegisterAll (void) {
|
||||
exsltCommonRegister();
|
||||
exsltMathRegister();
|
||||
exsltSetsRegister();
|
||||
exsltFuncRegister();
|
||||
}
|
||||
|
||||
|
@@ -14,12 +14,12 @@ extern const int exsltLibxmlVersion;
|
||||
#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets")
|
||||
#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions")
|
||||
|
||||
void exslCommonRegister (void);
|
||||
void exslMathRegister (void);
|
||||
void exslSetsRegister (void);
|
||||
void exslFuncRegister (void);
|
||||
void exsltCommonRegister (void);
|
||||
void exsltMathRegister (void);
|
||||
void exsltSetsRegister (void);
|
||||
void exsltFuncRegister (void);
|
||||
|
||||
void exslRegisterAll (void);
|
||||
void exsltRegisterAll (void);
|
||||
|
||||
#endif /* __EXSLT_H__ */
|
||||
|
||||
|
@@ -11,26 +11,28 @@
|
||||
#include "exslt.h"
|
||||
#include "utils.h"
|
||||
|
||||
typedef struct _exslFuncFunctionData exslFuncFunctionData;
|
||||
struct _exslFuncFunctionData {
|
||||
typedef struct _exsltFuncFunctionData exsltFuncFunctionData;
|
||||
struct _exsltFuncFunctionData {
|
||||
int nargs;
|
||||
xmlNodePtr content;
|
||||
};
|
||||
|
||||
typedef struct _exslFuncData exslFuncData;
|
||||
struct _exslFuncData {
|
||||
typedef struct _exsltFuncData exsltFuncData;
|
||||
struct _exsltFuncData {
|
||||
xmlHashTablePtr funcs;
|
||||
xmlXPathObjectPtr result;
|
||||
int error;
|
||||
};
|
||||
|
||||
void exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp);
|
||||
void exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp);
|
||||
static void exsltFuncFunctionElem (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node, xmlNodePtr inst,
|
||||
xsltStylePreCompPtr comp);
|
||||
static void exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node, xmlNodePtr inst,
|
||||
xsltStylePreCompPtr comp);
|
||||
|
||||
/**
|
||||
* exslFuncInit:
|
||||
* exsltFuncInit:
|
||||
* @ctxt: an XSLT transformation context
|
||||
* @URI: the namespace URI for the extension
|
||||
*
|
||||
@@ -38,43 +40,43 @@ void exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
*
|
||||
* Returns the data for this transformation
|
||||
*/
|
||||
static exslFuncData *
|
||||
exslFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
exslFuncData *ret;
|
||||
static exsltFuncData *
|
||||
exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
exsltFuncData *ret;
|
||||
|
||||
ret = (exslFuncData *) xmlMalloc (sizeof(exslFuncData));
|
||||
ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData));
|
||||
if (ret == NULL) {
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"exslFuncInit: not enough memory\n");
|
||||
"exsltFuncInit: not enough memory\n");
|
||||
return(NULL);
|
||||
}
|
||||
memset(ret, 0, sizeof(exsltFuncData));
|
||||
|
||||
ret->funcs = xmlHashCreate(1);
|
||||
ret->result = NULL;
|
||||
ret->error = 0;
|
||||
|
||||
xsltRegisterExtElement (ctxt, (const xmlChar *) "function",
|
||||
URI, exslFuncFunctionElem);
|
||||
URI, exsltFuncFunctionElem);
|
||||
xsltRegisterExtElement (ctxt, (const xmlChar *) "result",
|
||||
URI, exslFuncResultElem);
|
||||
|
||||
URI, exsltFuncResultElem);
|
||||
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* exslFuncShutdown:
|
||||
* exsltFuncShutdown:
|
||||
* @ctxt: an XSLT transformation context
|
||||
* @URI: the namespace URI fir the extension
|
||||
* @data: the module data to free up
|
||||
*
|
||||
* Shutdown the EXSLT - Functions module
|
||||
*/
|
||||
static static void
|
||||
exslFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
|
||||
const xmlChar *URI ATTRIBUTE_UNUSED,
|
||||
exslFuncData *data) {
|
||||
static void
|
||||
exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
|
||||
const xmlChar *URI ATTRIBUTE_UNUSED,
|
||||
exsltFuncData *data) {
|
||||
if (data->funcs != NULL)
|
||||
xmlHashFree(data->funcs, (xmlHashDeallocator) xmlFree);
|
||||
if (data->result != NULL)
|
||||
@@ -83,52 +85,53 @@ exslFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
/**
|
||||
* exslFuncRegister:
|
||||
* exsltFuncRegister:
|
||||
*
|
||||
* Registers the EXSLT - Functions module
|
||||
*/
|
||||
void
|
||||
exslFuncRegister (void) {
|
||||
exsltFuncRegister (void) {
|
||||
xsltRegisterExtModule (EXSLT_FUNCTIONS_NAMESPACE,
|
||||
(xsltExtInitFunction) exslFuncInit,
|
||||
(xsltExtShutdownFunction) exslFuncShutdown);
|
||||
(xsltExtInitFunction) exsltFuncInit,
|
||||
(xsltExtShutdownFunction) exsltFuncShutdown);
|
||||
}
|
||||
|
||||
/**
|
||||
* exslFuncNewFunctionData:
|
||||
* exsltFuncNewFunctionData:
|
||||
*
|
||||
* Allocates an #exslFuncFunctionData object
|
||||
*
|
||||
* Returns the new structure
|
||||
*/
|
||||
static exslFuncFunctionData *
|
||||
exslFuncNewFunctionData (void) {
|
||||
exslFuncFunctionData *ret;
|
||||
static exsltFuncFunctionData *
|
||||
exsltFuncNewFunctionData (void) {
|
||||
exsltFuncFunctionData *ret;
|
||||
|
||||
ret = (exslFuncFunctionData *) xmlMalloc (sizeof(exslFuncFunctionData));
|
||||
ret = (exsltFuncFunctionData *) xmlMalloc (sizeof(exsltFuncFunctionData));
|
||||
if (ret == NULL) {
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"exslFuncNewFunctionData: not enough memory\n");
|
||||
"exsltFuncNewFunctionData: not enough memory\n");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ret->nargs = 0;
|
||||
ret->content = NULL;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* exslFuncFunctionFunction:
|
||||
* exsltFuncFunctionFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Evaluates the func:function element defining the called function.
|
||||
*/
|
||||
static void
|
||||
exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlXPathObjectPtr obj, oldResult, ret;
|
||||
exslFuncData *data;
|
||||
exslFuncFunctionData *func;
|
||||
exsltFuncData *data;
|
||||
exsltFuncFunctionData *func;
|
||||
xmlNodePtr paramNode, oldInsert, fake;
|
||||
xsltStackElemPtr params = NULL, param;
|
||||
xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt);
|
||||
@@ -137,14 +140,14 @@ exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
/*
|
||||
* retrieve func:function template
|
||||
*/
|
||||
data = (exslFuncData *) xsltGetExtData (tctxt,
|
||||
EXSLT_FUNCTIONS_NAMESPACE);
|
||||
data = (exsltFuncData *) xsltGetExtData (tctxt,
|
||||
EXSLT_FUNCTIONS_NAMESPACE);
|
||||
oldResult = data->result;
|
||||
data->result = NULL;
|
||||
|
||||
func = (exslFuncFunctionData*) xmlHashLookup2 (data->funcs,
|
||||
ctxt->context->functionURI,
|
||||
ctxt->context->function);
|
||||
func = (exsltFuncFunctionData*) xmlHashLookup2 (data->funcs,
|
||||
ctxt->context->functionURI,
|
||||
ctxt->context->function);
|
||||
|
||||
/*
|
||||
* params handling
|
||||
@@ -222,13 +225,13 @@ exslFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
valuePush(ctxt, ret);
|
||||
}
|
||||
|
||||
void
|
||||
exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp) {
|
||||
static void
|
||||
exsltFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp) {
|
||||
xmlChar *name, *prefix;
|
||||
xmlNsPtr ns;
|
||||
exslFuncData *data;
|
||||
exslFuncFunctionData *func;
|
||||
exsltFuncData *data;
|
||||
exsltFuncFunctionData *func;
|
||||
xsltStylePreCompPtr param_comp;
|
||||
|
||||
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
|
||||
@@ -263,7 +266,7 @@ exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
/*
|
||||
* Create function data
|
||||
*/
|
||||
func = exslFuncNewFunctionData();
|
||||
func = exsltFuncNewFunctionData();
|
||||
func->content = inst->children;
|
||||
param_comp = (xsltStylePreCompPtr) func->content->_private;
|
||||
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
|
||||
* by exslFuncFunctionFunction
|
||||
*/
|
||||
data = (exslFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
|
||||
data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
|
||||
xmlHashAddEntry2 (data->funcs, ns->href, name, func);
|
||||
|
||||
/*
|
||||
@@ -284,17 +287,17 @@ exslFuncFunctionElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
* expressions.
|
||||
*/
|
||||
xsltRegisterExtFunction (ctxt, name, ns->href,
|
||||
exslFuncFunctionFunction);
|
||||
exsltFuncFunctionFunction);
|
||||
|
||||
xmlFree(name);
|
||||
}
|
||||
|
||||
void
|
||||
exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp) {
|
||||
static void
|
||||
exsltFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xmlNodePtr inst, xsltStylePreCompPtr comp) {
|
||||
xmlNodePtr test;
|
||||
xmlChar *select;
|
||||
exslFuncData *data;
|
||||
exsltFuncData *data;
|
||||
xmlXPathObjectPtr ret;
|
||||
|
||||
/*
|
||||
@@ -309,7 +312,7 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback"))
|
||||
continue;
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"exslFuncResultElem: only xsl:fallback is "
|
||||
"exsltFuncResultElem: only xsl:fallback is "
|
||||
"allowed to follow func:result\n");
|
||||
return;
|
||||
}
|
||||
@@ -347,10 +350,10 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
* func:function element results in the instantiation of more than
|
||||
* one func:result elements.
|
||||
*/
|
||||
data = (exslFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
|
||||
data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
|
||||
if (data == NULL) {
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"exslFuncReturnElem: data == NULL\n");
|
||||
"exsltFuncReturnElem: data == NULL\n");
|
||||
return;
|
||||
}
|
||||
if (data->result != NULL) {
|
||||
@@ -380,7 +383,7 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
ret = xmlXPathEvalExpression(select, ctxt->xpathCtxt);
|
||||
if (ret == NULL) {
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"exslFuncResultElem: ret == NULL\n");
|
||||
"exsltFuncResultElem: ret == NULL\n");
|
||||
return;
|
||||
}
|
||||
} else if (test->children != NULL) {
|
||||
@@ -402,7 +405,7 @@ exslFuncResultElem (xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
ret = xmlXPathNewValueTree(container);
|
||||
if (ret == NULL) {
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"exslFuncResultElem: ret == NULL\n");
|
||||
"exsltFuncResultElem: ret == NULL\n");
|
||||
data->error = 1;
|
||||
}
|
||||
} else {
|
||||
|
@@ -13,7 +13,7 @@
|
||||
extern double xmlXPathNAN;
|
||||
|
||||
/**
|
||||
* exslMathMin:
|
||||
* exsltMathMin:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Implements the EXSLT - Math min() function:
|
||||
@@ -24,7 +24,7 @@ extern double xmlXPathNAN;
|
||||
* turns into NaN.
|
||||
*/
|
||||
static double
|
||||
exslMathMin (xmlNodeSetPtr ns) {
|
||||
exsltMathMin (xmlNodeSetPtr ns) {
|
||||
double ret, cur;
|
||||
int i;
|
||||
|
||||
@@ -44,14 +44,14 @@ exslMathMin (xmlNodeSetPtr ns) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathMinFunction:
|
||||
* exsltMathMinFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslMathMin for use by the XPath processor.
|
||||
* Wraps #exsltMathMin for use by the XPath processor.
|
||||
*/
|
||||
static void
|
||||
exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr ns;
|
||||
double ret;
|
||||
|
||||
@@ -65,7 +65,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
if (xmlXPathCheckError(ctxt))
|
||||
return;
|
||||
|
||||
ret = exslMathMin(ns);
|
||||
ret = exsltMathMin(ns);
|
||||
|
||||
xmlXPathFreeNodeSet(ns);
|
||||
|
||||
@@ -74,7 +74,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
|
||||
|
||||
/**
|
||||
* exslMathMax:
|
||||
* exsltMathMax:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Implements the EXSLT - Math max() function:
|
||||
@@ -85,7 +85,7 @@ exslMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* turns into NaN.
|
||||
*/
|
||||
static double
|
||||
exslMathMax (xmlNodeSetPtr ns) {
|
||||
exsltMathMax (xmlNodeSetPtr ns) {
|
||||
double ret, cur;
|
||||
int i;
|
||||
|
||||
@@ -105,14 +105,14 @@ exslMathMax (xmlNodeSetPtr ns) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathMaxFunction:
|
||||
* exsltMathMaxFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslMathMax for use by the XPath processor.
|
||||
* Wraps #exsltMathMax for use by the XPath processor.
|
||||
*/
|
||||
static void
|
||||
exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr ns;
|
||||
double ret;
|
||||
|
||||
@@ -124,7 +124,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
if (xmlXPathCheckError(ctxt))
|
||||
return;
|
||||
|
||||
ret = exslMathMax(ns);
|
||||
ret = exsltMathMax(ns);
|
||||
|
||||
xmlXPathFreeNodeSet(ns);
|
||||
|
||||
@@ -132,7 +132,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathHighest:
|
||||
* exsltMathHighest:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Implements the EXSLT - Math highest() function:
|
||||
@@ -142,7 +142,7 @@ exslMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* for the node-set.
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslMathHighest (xmlNodeSetPtr ns) {
|
||||
exsltMathHighest (xmlNodeSetPtr ns) {
|
||||
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
|
||||
double max, cur;
|
||||
int i;
|
||||
@@ -176,14 +176,14 @@ exslMathHighest (xmlNodeSetPtr ns) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathHighestFunction:
|
||||
* exsltMathHighestFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslMathHighest for use by the XPath processor
|
||||
* Wraps #exsltMathHighest for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr ns, ret;
|
||||
|
||||
if (nargs != 1) {
|
||||
@@ -195,7 +195,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
if (xmlXPathCheckError(ctxt))
|
||||
return;
|
||||
|
||||
ret = exslMathHighest(ns);
|
||||
ret = exsltMathHighest(ns);
|
||||
|
||||
xmlXPathFreeNodeSet(ns);
|
||||
|
||||
@@ -203,7 +203,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathLowest:
|
||||
* exsltMathLowest:
|
||||
* @ns: a node-set
|
||||
*
|
||||
* Implements the EXSLT - Math lowest() function
|
||||
@@ -213,7 +213,7 @@ exslMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* for the node-set.
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslMathLowest (xmlNodeSetPtr ns) {
|
||||
exsltMathLowest (xmlNodeSetPtr ns) {
|
||||
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
|
||||
double min, cur;
|
||||
int i;
|
||||
@@ -247,14 +247,14 @@ exslMathLowest (xmlNodeSetPtr ns) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathLowestFunction:
|
||||
* exsltMathLowestFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslMathLowest for use by the XPath processor
|
||||
* Wraps #exsltMathLowest for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr ns, ret;
|
||||
|
||||
if (nargs != 1) {
|
||||
@@ -266,7 +266,7 @@ exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
if (xmlXPathCheckError(ctxt))
|
||||
return;
|
||||
|
||||
ret = exslMathLowest(ns);
|
||||
ret = exsltMathLowest(ns);
|
||||
|
||||
xmlXPathFreeNodeSet(ns);
|
||||
|
||||
@@ -274,25 +274,25 @@ exslMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
static void *
|
||||
exslMathInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
exsltMathInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "min",
|
||||
URI, exslMathMinFunction);
|
||||
URI, exsltMathMinFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "max",
|
||||
URI, exslMathMaxFunction);
|
||||
URI, exsltMathMaxFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "highest",
|
||||
URI, exslMathHighestFunction);
|
||||
URI, exsltMathHighestFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "lowest",
|
||||
URI, exslMathLowestFunction);
|
||||
URI, exsltMathLowestFunction);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* exslMathRegister:
|
||||
* exsltMathRegister:
|
||||
*
|
||||
* Registers the EXSLT - Math module
|
||||
*/
|
||||
|
||||
void
|
||||
exslMathRegister (void) {
|
||||
xsltRegisterExtModule (EXSLT_MATH_NAMESPACE, exslMathInit, NULL);
|
||||
exsltMathRegister (void) {
|
||||
xsltRegisterExtModule (EXSLT_MATH_NAMESPACE, exsltMathInit, NULL);
|
||||
}
|
||||
|
146
libexslt/sets.c
146
libexslt/sets.c
@@ -10,7 +10,7 @@
|
||||
#include "utils.h"
|
||||
|
||||
/**
|
||||
* exslSetsDifference:
|
||||
* exsltSetsDifference:
|
||||
* @nodes1: a node-set
|
||||
* @nodes2: a node-set
|
||||
*
|
||||
@@ -21,7 +21,7 @@
|
||||
* nodes2 is empty
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
xmlNodeSetPtr ret;
|
||||
int i, l1;
|
||||
xmlNodePtr cur;
|
||||
@@ -44,14 +44,14 @@ exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsDifferenceFunction:
|
||||
* exsltSetsDifferenceFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslSetsDifference for use by the XPath processor
|
||||
* Wraps #exsltSetsDifference for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr arg1, arg2, ret;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -71,7 +71,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = exslSetsDifference(arg1, arg2);
|
||||
ret = exsltSetsDifference(arg1, arg2);
|
||||
|
||||
if (ret != arg1)
|
||||
xmlXPathFreeNodeSet(arg1);
|
||||
@@ -81,7 +81,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsIntersection:
|
||||
* exsltSetsIntersection:
|
||||
* @nodes1: a node-set
|
||||
* @nodes2: a node-set
|
||||
*
|
||||
@@ -92,7 +92,7 @@ exslSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* node sets passed as arguments
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
|
||||
int i, l1;
|
||||
xmlNodePtr cur;
|
||||
@@ -113,14 +113,14 @@ exslSetsIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsIntersectionFunction:
|
||||
* exsltSetsIntersectionFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslSetsIntersection for use by the XPath processor
|
||||
* Wraps #exsltSetsIntersection for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr arg1, arg2, ret;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -140,7 +140,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = exslSetsIntersection(arg1, arg2);
|
||||
ret = exsltSetsIntersection(arg1, arg2);
|
||||
|
||||
xmlXPathFreeNodeSet(arg1);
|
||||
xmlXPathFreeNodeSet(arg2);
|
||||
@@ -149,7 +149,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsDistinctSorted:
|
||||
* exsltSetsDistinctSorted:
|
||||
* @nodes: a node-set, sorted by document order
|
||||
*
|
||||
* Implements the EXSLT - Sets distinct() function:
|
||||
@@ -159,7 +159,7 @@ exslSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* it is empty
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslSetsDistinctSorted (xmlNodeSetPtr nodes) {
|
||||
exsltSetsDistinctSorted (xmlNodeSetPtr nodes) {
|
||||
xmlNodeSetPtr ret;
|
||||
xmlHashTablePtr hash;
|
||||
int i, l;
|
||||
@@ -187,7 +187,7 @@ exslSetsDistinctSorted (xmlNodeSetPtr nodes) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsDistinct:
|
||||
* exsltSetsDistinct:
|
||||
* @nodes: a node-set
|
||||
*
|
||||
* Implements the EXSLT - Sets distinct() function:
|
||||
@@ -199,23 +199,23 @@ exslSetsDistinctSorted (xmlNodeSetPtr nodes) {
|
||||
* it is empty
|
||||
*/
|
||||
xmlNodeSetPtr
|
||||
exslSetsDistinct (xmlNodeSetPtr nodes) {
|
||||
exsltSetsDistinct (xmlNodeSetPtr nodes) {
|
||||
if (xmlXPathNodeSetIsEmpty(nodes))
|
||||
return(nodes);
|
||||
|
||||
xmlXPathNodeSetSort(nodes);
|
||||
return(exslSetsDistinctSorted(nodes));
|
||||
return(exsltSetsDistinctSorted(nodes));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsDistinctFunction:
|
||||
* exsltSetsDistinctFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslSetsDistinct for use by the XPath processor
|
||||
* Wraps #exsltSetsDistinct for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr ns, ret;
|
||||
|
||||
if (nargs != 1) {
|
||||
@@ -228,7 +228,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
return;
|
||||
|
||||
/* !!! must be sorted !!! */
|
||||
ret = exslSetsDistinctSorted(ns);
|
||||
ret = exsltSetsDistinctSorted(ns);
|
||||
|
||||
xmlXPathFreeNodeSet(ns);
|
||||
|
||||
@@ -236,7 +236,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsHasSameNodes:
|
||||
* exsltSetsHasSameNodes:
|
||||
* @nodes1: a node-set
|
||||
* @nodes2: a node-set
|
||||
*
|
||||
@@ -247,7 +247,7 @@ exslSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* otherwise
|
||||
*/
|
||||
static int
|
||||
exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
int i, l;
|
||||
xmlNodePtr cur;
|
||||
|
||||
@@ -265,14 +265,14 @@ exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsHasSameNodesFunction:
|
||||
* exsltSetsHasSameNodesFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslSetsHasSameNodes for use by the XPath processor
|
||||
* Wraps #exsltSetsHasSameNodes for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
|
||||
exsltSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
|
||||
int nargs) {
|
||||
xmlNodeSetPtr arg1, arg2;
|
||||
int ret;
|
||||
@@ -294,7 +294,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
|
||||
return;
|
||||
}
|
||||
|
||||
ret = exslSetsHasSameNodes(arg1, arg2);
|
||||
ret = exsltSetsHasSameNodes(arg1, arg2);
|
||||
|
||||
xmlXPathFreeNodeSet(arg1);
|
||||
xmlXPathFreeNodeSet(arg2);
|
||||
@@ -303,7 +303,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsNodeLeadingSorted:
|
||||
* exsltSetsNodeLeadingSorted:
|
||||
* @nodes: a node-set, sorted by document order
|
||||
* @node: a node
|
||||
*
|
||||
@@ -315,7 +315,7 @@ exslSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt,
|
||||
* doesn't contain @node
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
exsltSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
int i, l;
|
||||
xmlNodePtr cur;
|
||||
xmlNodeSetPtr ret;
|
||||
@@ -339,7 +339,7 @@ exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsNodeLeading:
|
||||
* exsltSetsNodeLeading:
|
||||
* @nodes: a node-set
|
||||
* @node: a node
|
||||
*
|
||||
@@ -353,13 +353,13 @@ exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
* doesn't contain @node
|
||||
*/
|
||||
xmlNodeSetPtr
|
||||
exslSetsNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
exsltSetsNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
xmlXPathNodeSetSort(nodes);
|
||||
return(exslSetsNodeLeadingSorted(nodes, node));
|
||||
return(exsltSetsNodeLeadingSorted(nodes, node));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsLeadingSorted:
|
||||
* exsltSetsLeadingSorted:
|
||||
* @nodes1: 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
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslSetsLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
if (xmlXPathNodeSetIsEmpty(nodes2))
|
||||
return(nodes1);
|
||||
return(exslSetsNodeLeadingSorted(nodes1,
|
||||
return(exsltSetsNodeLeadingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsLeading:
|
||||
* exsltSetsLeading:
|
||||
* @nodes1: 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
|
||||
*/
|
||||
xmlNodeSetPtr
|
||||
exslSetsLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
if (xmlXPathNodeSetIsEmpty(nodes2))
|
||||
return(nodes1);
|
||||
if (xmlXPathNodeSetIsEmpty(nodes1))
|
||||
return(xmlXPathNodeSetCreate(NULL));
|
||||
xmlXPathNodeSetSort(nodes1);
|
||||
xmlXPathNodeSetSort(nodes2);
|
||||
return(exslSetsNodeLeadingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 1)));
|
||||
return(exsltSetsNodeLeadingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsLeadingFunction:
|
||||
* exsltSetsLeadingFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslSetsLeading for use by the XPath processor
|
||||
* Wraps #exsltSetsLeading for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr arg1, arg2, ret;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -432,7 +432,8 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = exslSetsLeadingSorted(arg1, arg2);
|
||||
/* !!! must be sorted */
|
||||
ret = exsltSetsLeadingSorted(arg1, arg2);
|
||||
|
||||
xmlXPathFreeNodeSet(arg1);
|
||||
xmlXPathFreeNodeSet(arg2);
|
||||
@@ -441,7 +442,7 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsNodeTrailingSorted:
|
||||
* exsltSetsNodeTrailingSorted:
|
||||
* @nodes: a node-set, sorted by document order
|
||||
* @node: a node
|
||||
*
|
||||
@@ -453,7 +454,7 @@ exslSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
* doesn't contain @node
|
||||
*/
|
||||
static xmlNodeSetPtr
|
||||
exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
exsltSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
int i, l;
|
||||
xmlNodePtr cur;
|
||||
xmlNodeSetPtr ret;
|
||||
@@ -477,13 +478,13 @@ exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsNodeTrailing:
|
||||
* exsltSetsNodeTrailing:
|
||||
* @nodes: a node-set
|
||||
* @node: a node
|
||||
*
|
||||
* Implements the EXSLT - Sets trailing() function:
|
||||
* 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.
|
||||
*
|
||||
* Returns the nodes in @nodes that follow @node in document order,
|
||||
@@ -491,13 +492,13 @@ exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
* doesn't contain @node
|
||||
*/
|
||||
xmlNodeSetPtr
|
||||
exslSetsNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
exsltSetsNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node) {
|
||||
xmlXPathNodeSetSort(nodes);
|
||||
return(exslSetsNodeTrailingSorted(nodes, node));
|
||||
return(exsltSetsNodeTrailingSorted(nodes, node));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsTrailingSorted:
|
||||
* exsltSetsTrailingSorted:
|
||||
* @nodes1: 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
|
||||
*/
|
||||
xmlNodeSetPtr
|
||||
exslSetsTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
if (xmlXPathNodeSetIsEmpty(nodes2))
|
||||
return(nodes1);
|
||||
return(exslSetsNodeTrailingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 0)));
|
||||
return(exsltSetsNodeTrailingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsTrailing:
|
||||
* exsltSetsTrailing:
|
||||
* @nodes1: a node-set
|
||||
* @nodes2: a node-set
|
||||
*
|
||||
* Implements the EXSLT - Sets trailing() function:
|
||||
* node-set set:trailing (node-set, node-set)
|
||||
* @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
|
||||
* in document order, @nodes1 if @nodes2 is NULL or empty or
|
||||
* an empty node-set if @nodes1 doesn't contain @nodes2
|
||||
*/
|
||||
xmlNodeSetPtr
|
||||
exslSetsTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
exsltSetsTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
|
||||
if (xmlXPathNodeSetIsEmpty(nodes2))
|
||||
return(nodes1);
|
||||
if (xmlXPathNodeSetIsEmpty(nodes1))
|
||||
return(xmlXPathNodeSetCreate(NULL));
|
||||
xmlXPathNodeSetSort(nodes1);
|
||||
xmlXPathNodeSetSort(nodes2);
|
||||
return(exslSetsNodeTrailingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 0)));
|
||||
return(exsltSetsNodeTrailingSorted(nodes1,
|
||||
xmlXPathNodeSetItem(nodes2, 0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* exslSetsTrailingFunction:
|
||||
* exsltSetsTrailingFunction:
|
||||
* @ctxt: an XPath parser context
|
||||
* @nargs: the number of arguments
|
||||
*
|
||||
* Wraps #exslSetsTrailing for use by the XPath processor
|
||||
* Wraps #exsltSetsTrailing for use by the XPath processor
|
||||
*/
|
||||
static void
|
||||
exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
exsltSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
xmlNodeSetPtr arg1, arg2, ret;
|
||||
|
||||
if (nargs != 2) {
|
||||
@@ -570,7 +571,8 @@ exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = exslSetsNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
|
||||
/* !!! mist be sorted */
|
||||
ret = exsltSetsNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
|
||||
|
||||
xmlXPathFreeNodeSet(arg1);
|
||||
xmlXPathFreeNodeSet(arg2);
|
||||
@@ -579,30 +581,30 @@ exslSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
||||
}
|
||||
|
||||
static void *
|
||||
exslSetsInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
exsltSetsInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "difference",
|
||||
URI, exslSetsDifferenceFunction);
|
||||
URI, exsltSetsDifferenceFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "intersection",
|
||||
URI, exslSetsIntersectionFunction);
|
||||
URI, exsltSetsIntersectionFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "distinct",
|
||||
URI, exslSetsDistinctFunction);
|
||||
URI, exsltSetsDistinctFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "has-same-nodes",
|
||||
URI, exslSetsHasSameNodesFunction);
|
||||
URI, exsltSetsHasSameNodesFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "leading",
|
||||
URI, exslSetsLeadingFunction);
|
||||
URI, exsltSetsLeadingFunction);
|
||||
xsltRegisterExtFunction (ctxt, (const xmlChar *) "trailing",
|
||||
URI, exslSetsTrailingFunction);
|
||||
URI, exsltSetsTrailingFunction);
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* exslCommonRegister:
|
||||
* exsltCommonRegister:
|
||||
*
|
||||
* Registers the EXSLT - Sets module
|
||||
*/
|
||||
|
||||
void
|
||||
exslSetsRegister (void) {
|
||||
xsltRegisterExtModule (EXSLT_SETS_NAMESPACE, exslSetsInit, NULL);
|
||||
exsltSetsRegister (void) {
|
||||
xsltRegisterExtModule (EXSLT_SETS_NAMESPACE, exsltSetsInit, NULL);
|
||||
}
|
||||
|
@@ -123,7 +123,9 @@ xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){
|
||||
ctxt->error = XPATH_INVALID_ARITY;
|
||||
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);
|
||||
xsltGenericError(xsltGenericErrorContext,
|
||||
"node-set() invalid arg expecting a result tree\n");
|
||||
|
@@ -406,7 +406,7 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* Register the EXSLT extensions
|
||||
*/
|
||||
exslRegisterAll();
|
||||
exsltRegisterAll();
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if ((!strcmp(argv[i], "-maxdepth")) ||
|
||||
|
Reference in New Issue
Block a user