Re: [xml] XPath functions ignoring their name
- From: Daniel Veillard <veillard redhat com>
- To: Thomas Broyer <tbroyer ltgt net>
- Cc: xml gnome org
- Subject: Re: [xml] XPath functions ignoring their name
- Date: Tue, 22 May 2001 02:21:08 -0400
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 ("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.
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
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.
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
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]