Commit 42596ad2 authored by Daniel Veillard's avatar Daniel Veillard

- tree.c: fixed a gross mistake in base computation, xml:base is

  not completely correct yet (need cascade).
- xpath.[ch]: added the few things needed to find a function name
  and URI from the XPath context when it is called.
Daniel
parent 81418e38
Tue May 22 18:46:56 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* tree.c: fixed a gross mistake in base computation, xml:base is
not completely correct yet (need cascade).
* xpath.[ch]: added the few things needed to find a function name
and URI from the XPath context when it is called.
Tue May 22 17:00:36 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* catalog.[ch]: fixes and add xmlLoadCatalogs()
......
......@@ -222,6 +222,10 @@ struct _xmlXPathContext {
/* Possibility to link in an extra item */
void *extra; /* needed for XSLT */
/* The function name and URI when calling a function */
const xmlChar *function;
const xmlChar *functionURI;
};
/*
......
......@@ -3267,9 +3267,13 @@ xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) {
xmlEntityPtr ent = (xmlEntityPtr) cur;
return(xmlStrdup(ent->URI));
}
base = xmlGetProp(cur, BAD_CAST "xml:base");
if (base != NULL)
return(base);
if (cur->type == XML_ELEMENT_NODE) {
base = xmlGetProp(cur, BAD_CAST "xml:base");
if (base != NULL) {
/* TODO : apply cascade in the base resolution ! */
return(base);
}
}
cur = cur->parent;
}
if ((doc != NULL) && (doc->URL != NULL))
......
......@@ -279,6 +279,7 @@ struct _xmlXPathStepOp {
void *value4;
void *value5;
void *cache;
void *cacheURI;
};
struct _xmlXPathCompExpr {
......@@ -5487,9 +5488,8 @@ encoding_error:
* to ISO-Latin-1 (if you don't like this policy, just declare the
* encoding !)
*/
*len = 0;
XP_ERROR0(XPATH_ENCODING_ERROR);
*len = 1;
return((int) *cur);
}
/**
......@@ -7571,16 +7571,18 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
}
case XPATH_OP_FUNCTION: {
xmlXPathFunction func;
const xmlChar *oldFunc, *oldFuncURI;
if (op->ch1 != -1)
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
if (op->cache != NULL)
func = (xmlXPathFunction) op->cache;
else {
const xmlChar *URI = NULL;
if (op->value5 == NULL)
func = xmlXPathFunctionLookup(ctxt->context, op->value4);
else {
const xmlChar *URI;
URI = xmlXPathNsLookup(ctxt->context, op->value5);
if (URI == NULL) {
xmlGenericError(xmlGenericErrorContext,
......@@ -7599,8 +7601,15 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
return;
}
op->cache = (void *) func;
op->cacheURI = (void *) URI;
}
oldFunc = ctxt->context->function;
oldFuncURI = ctxt->context->functionURI;
ctxt->context->function = op->value4;
ctxt->context->functionURI = op->cacheURI;
func(ctxt, op->value);
ctxt->context->function = oldFunc;
ctxt->context->functionURI = oldFuncURI;
return;
}
case XPATH_OP_ARG:
......
......@@ -222,6 +222,10 @@ struct _xmlXPathContext {
/* Possibility to link in an extra item */
void *extra; /* needed for XSLT */
/* The function name and URI when calling a function */
const xmlChar *function;
const xmlChar *functionURI;
};
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment