Re: [xml] XPath functions ignoring their name

On Tue, May 22, 2001 at 04:17:19AM +0200, Thomas Broyer wrote:

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 ("";) of the function.
Have a look to the example of func:function in the libxslt list to see why
I need this.

  I'm pretty sure this can be found in the current OP evaluated in the 
XPath module. Providing those is relatively simple.

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

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.

  Hum this is very clear it does break compatibility. For example the
code in libxslt would need to be modified and the shared lib would
not work with a previous libxml shared lib. API and ABI breakage (of libxml).
Sorry, this is not possible. Extending the context is certainly cleaner
at this point.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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