Re: [xml] XPath functions ignoring their name



Le 16/05/01 09:07:12, Daniel Veillard a écrit :
As I explained in the xslt list, I need a way of retrieving the name
of the currently called XPath function since I have a single function
answering calls for multiple XPath functions (this is for the EXSLT -
Functions implementation).

  Hum, right, I see what you mean, something like self() in OO languages.

Not exactly. If I use, e.g., the EXSLT set:distinct() function, the
callback should be able to retrieve the local-name ("distinct') and
namespace URI ("http://exslt.org/sets";) of the function.
Have a look to the example of func:function in the libxslt list to see why
I need this.

This is similar to the fact that, in libxslt, an element callback can
access the local-name and namespace URI of the element (like in
xsltDocumentElem)

Can I add a pointer to the current xmlXPathSetOp, or its index in the
comp->steps list, or directly to the function name and namespace URI
(which of the three should I prefer?), in the xmlXPathParserContext?

  If this is just needed at compilation time, I would prefer to have
it added at the end of xmlXPathParserContext.

I wonder if it wouldn't be better passing them (local name and namespace
URI) as const xmlChar* arguments to the callback function (modifying the
xmlXPathEvalFunc type into «typedef void (*xmlXPathEvalFunc)
(xmlXPathParserContextPtr ctxt, int nargs, const xmlChar *localName, const
xmlChar *nsURI)»).
This shouldn't break compatibility I guess.

Tom.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]