Re: [xml] Using variables with XPath expressions
- From: Daniel Veillard <veillard redhat com>
- To: "Vakoc, Mark" <Mark_Vakoc jdedwards com>
- Cc: "'xml gnome org'" <xml gnome org>
- Subject: Re: [xml] Using variables with XPath expressions
- Date: Tue, 3 Jul 2001 18:22:28 -0400
On Tue, Jul 03, 2001 at 04:00:02PM -0600, Vakoc, Mark wrote:
My fix (I believe) was to correct xmlXPathCompOpEval to use a copy of the
variable value rather than the value directly. I have done a fair amount of
testing using this and all my expressions using variables return the
expected results.
case XPATH_OP_VARIABLE: {
if (op->ch1 != -1)
xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
if (op->value5 == NULL)
-- valuePush(ctxt,
-- xmlXPathVariableLookup(ctxt->context, op->value4));
++ valuePush(ctxt,xmlXPathObjectCopy(
xmlXPathVariableLookup(ctxt->context, op->value4)) );
Daniel - Can you confirm that this is the right approach.
That would be one way to do it, but would change the interface between
libxml and libxslt (which uses the xmlXPathRegisterVariableLookup()
mechanism and where the registered lookup function does the copy),
so I would rather fix the default Variable lookup to do this copy
and hence change the end of xmlXPathVariableLookupNS() to
-------------------
if (ctxt->varHash == NULL)
return(NULL);
if (name == NULL)
return(NULL);
return(xmlXPathObjectCopy((xmlXPathObjectPtr)
xmlHashLookup2(ctxt->varHash, name, ns_uri)));
}
-------------------
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/
Sep 17-18 2001 Brussels Red Hat TechWorld http://www.redhat-techworld.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]