Index: xpath.c =================================================================== RCS file: /cvs/gnome/gnome-xml/xpath.c,v retrieving revision 1.116 diff -c -r1.116 xpath.c *** xpath.c 2001/05/22 15:08:55 1.116 --- xpath.c 2001/05/22 16:50:14 *************** *** 279,284 **** --- 279,285 ---- void *value4; void *value5; void *cache; + void *cacheURI; }; struct _xmlXPathCompExpr { *************** *** 5487,5495 **** * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ XP_ERROR0(XPATH_ENCODING_ERROR); - *len = 1; - return((int) *cur); } /** --- 5488,5495 ---- * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ + *len = 0; XP_ERROR0(XPATH_ENCODING_ERROR); } /** *************** *** 7571,7586 **** } case XPATH_OP_FUNCTION: { xmlXPathFunction func; if (op->ch1 != -1) xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); if (op->cache != NULL) func = (xmlXPathFunction) op->cache; else { 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, --- 7571,7588 ---- } 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 { URI = xmlXPathNsLookup(ctxt->context, op->value5); if (URI == NULL) { xmlGenericError(xmlGenericErrorContext, *************** *** 7599,7606 **** --- 7601,7615 ---- 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: Index: xpath.h =================================================================== RCS file: /cvs/gnome/gnome-xml/xpath.h,v retrieving revision 1.39 diff -c -r1.39 xpath.h *** xpath.h 2001/05/19 14:59:47 1.39 --- xpath.h 2001/05/22 16:50:15 *************** *** 222,227 **** --- 222,231 ---- /* 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; }; /*