+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:
functions.lo
functions.o
utils.lo
-utils.o
\ No newline at end of file
+utils.o
+.deps
+.libs
+exsltconfig.h
exsltinc_HEADERS = \
exslt.h \
- utils.h \
exsltconfig.h
libexslt_la_SOURCES = \
-#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) {
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);
}
/**
- * exslCommonRegister:
+ * exsltCommonRegister:
*
* Registers the EXSLT - Common module
*/
void
-exslCommonRegister (void) {
+exsltCommonRegister (void) {
xsltRegisterExtModule (EXSLT_COMMON_NAMESPACE,
- exslCommonInit, NULL);
+ exsltCommonInit, NULL);
}
+#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();
}
#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__ */
#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
*
*
* 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)
}
/**
- * 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);
/*
* 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
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))
/*
* 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)) {
* 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);
/*
* 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;
/*
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;
}
* 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) {
ret = xmlXPathEvalExpression(select, ctxt->xpathCtxt);
if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext,
- "exslFuncResultElem: ret == NULL\n");
+ "exsltFuncResultElem: ret == NULL\n");
return;
}
} else if (test->children != NULL) {
ret = xmlXPathNewValueTree(container);
if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext,
- "exslFuncResultElem: ret == NULL\n");
+ "exsltFuncResultElem: ret == NULL\n");
data->error = 1;
}
} else {
extern double xmlXPathNAN;
/**
- * exslMathMin:
+ * exsltMathMin:
* @ns: a node-set
*
* Implements the EXSLT - Math min() function:
* turns into NaN.
*/
static double
-exslMathMin (xmlNodeSetPtr ns) {
+exsltMathMin (xmlNodeSetPtr ns) {
double ret, cur;
int i;
}
/**
- * 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;
if (xmlXPathCheckError(ctxt))
return;
- ret = exslMathMin(ns);
+ ret = exsltMathMin(ns);
xmlXPathFreeNodeSet(ns);
/**
- * exslMathMax:
+ * exsltMathMax:
* @ns: a node-set
*
* Implements the EXSLT - Math max() function:
* turns into NaN.
*/
static double
-exslMathMax (xmlNodeSetPtr ns) {
+exsltMathMax (xmlNodeSetPtr ns) {
double ret, cur;
int i;
}
/**
- * 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;
if (xmlXPathCheckError(ctxt))
return;
- ret = exslMathMax(ns);
+ ret = exsltMathMax(ns);
xmlXPathFreeNodeSet(ns);
}
/**
- * exslMathHighest:
+ * exsltMathHighest:
* @ns: a node-set
*
* Implements the EXSLT - Math highest() function:
* for the node-set.
*/
static xmlNodeSetPtr
-exslMathHighest (xmlNodeSetPtr ns) {
+exsltMathHighest (xmlNodeSetPtr ns) {
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
double max, cur;
int i;
}
/**
- * 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) {
if (xmlXPathCheckError(ctxt))
return;
- ret = exslMathHighest(ns);
+ ret = exsltMathHighest(ns);
xmlXPathFreeNodeSet(ns);
}
/**
- * exslMathLowest:
+ * exsltMathLowest:
* @ns: a node-set
*
* Implements the EXSLT - Math lowest() function
* for the node-set.
*/
static xmlNodeSetPtr
-exslMathLowest (xmlNodeSetPtr ns) {
+exsltMathLowest (xmlNodeSetPtr ns) {
xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL);
double min, cur;
int i;
}
/**
- * 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) {
if (xmlXPathCheckError(ctxt))
return;
- ret = exslMathLowest(ns);
+ ret = exsltMathLowest(ns);
xmlXPathFreeNodeSet(ns);
}
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);
}
#include "utils.h"
/**
- * exslSetsDifference:
+ * exsltSetsDifference:
* @nodes1: a node-set
* @nodes2: a node-set
*
* nodes2 is empty
*/
static xmlNodeSetPtr
-exslSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
+exsltSetsDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
xmlNodeSetPtr ret;
int i, l1;
xmlNodePtr cur;
}
/**
- * 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) {
return;
}
- ret = exslSetsDifference(arg1, arg2);
+ ret = exsltSetsDifference(arg1, arg2);
if (ret != arg1)
xmlXPathFreeNodeSet(arg1);
}
/**
- * exslSetsIntersection:
+ * exsltSetsIntersection:
* @nodes1: a node-set
* @nodes2: a node-set
*
* 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;
}
/**
- * 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) {
return;
}
- ret = exslSetsIntersection(arg1, arg2);
+ ret = exsltSetsIntersection(arg1, arg2);
xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2);
}
/**
- * exslSetsDistinctSorted:
+ * exsltSetsDistinctSorted:
* @nodes: a node-set, sorted by document order
*
* Implements the EXSLT - Sets distinct() function:
* it is empty
*/
static xmlNodeSetPtr
-exslSetsDistinctSorted (xmlNodeSetPtr nodes) {
+exsltSetsDistinctSorted (xmlNodeSetPtr nodes) {
xmlNodeSetPtr ret;
xmlHashTablePtr hash;
int i, l;
}
/**
- * exslSetsDistinct:
+ * exsltSetsDistinct:
* @nodes: a node-set
*
* Implements the EXSLT - Sets distinct() function:
* 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) {
return;
/* !!! must be sorted !!! */
- ret = exslSetsDistinctSorted(ns);
+ ret = exsltSetsDistinctSorted(ns);
xmlXPathFreeNodeSet(ns);
}
/**
- * exslSetsHasSameNodes:
+ * exsltSetsHasSameNodes:
* @nodes1: a node-set
* @nodes2: a node-set
*
* otherwise
*/
static int
-exslSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
+exsltSetsHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) {
int i, l;
xmlNodePtr cur;
}
/**
- * 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;
return;
}
- ret = exslSetsHasSameNodes(arg1, arg2);
+ ret = exsltSetsHasSameNodes(arg1, arg2);
xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2);
}
/**
- * exslSetsNodeLeadingSorted:
+ * exsltSetsNodeLeadingSorted:
* @nodes: a node-set, sorted by document order
* @node: a node
*
* doesn't contain @node
*/
static xmlNodeSetPtr
-exslSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
+exsltSetsNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
int i, l;
xmlNodePtr cur;
xmlNodeSetPtr ret;
}
/**
- * exslSetsNodeLeading:
+ * exsltSetsNodeLeading:
* @nodes: a node-set
* @node: a 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
*
* 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
*
* 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) {
return;
}
- ret = exslSetsLeadingSorted(arg1, arg2);
+ /* !!! must be sorted */
+ ret = exsltSetsLeadingSorted(arg1, arg2);
xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2);
}
/**
- * exslSetsNodeTrailingSorted:
+ * exsltSetsNodeTrailingSorted:
* @nodes: a node-set, sorted by document order
* @node: a node
*
* doesn't contain @node
*/
static xmlNodeSetPtr
-exslSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
+exsltSetsNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) {
int i, l;
xmlNodePtr cur;
xmlNodeSetPtr ret;
}
/**
- * 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,
* 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
*
* 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) {
return;
}
- ret = exslSetsNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
+ /* !!! mist be sorted */
+ ret = exsltSetsNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0));
xmlXPathFreeNodeSet(arg1);
xmlXPathFreeNodeSet(arg2);
}
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);
}
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");
/*
* Register the EXSLT extensions
*/
- exslRegisterAll();
+ exsltRegisterAll();
for (i = 1; i < argc; i++) {
if ((!strcmp(argv[i], "-maxdepth")) ||