Re: [tbroyer ltgt net: Re: [xslt] Problem with key()]
- From: Brent M Hendricks <brent valinor waldenweb com>
- To: xslt gnome org
- Subject: Re: [tbroyer ltgt net: Re: [xslt] Problem with key()]
- Date: Tue, 17 Apr 2001 21:12:00 -0500
Excellent! This seems to work. Thanks.
(on to more bug hunting :)
--Brent
On Wed, Apr 18, 2001 at 01:08:39AM +0200, Thomas Broyer wrote:
> Le 17/04/01 22:55:31, Brent Hendricks a ?crit :
> > I'm having trouble getting the key() function to work when the second
> > argument is a nodeset, rather than a string.
> [...]
> > I tried to trace the execution under gdb, but I get caught in a
> > seemingly infinite recursion in xsltKeyFunction():
>
> Of course, I forgot converting the node-set to its string value, thus obj2
> was always a node-set!
>
> > if (obj2->type == XPATH_NODESET) {
> > int i;
> > xmlXPathObjectPtr newobj, ret;
> >
> > ret = xmlXPathNewNodeSet(NULL);
> >
> > if (obj2->nodesetval != NULL) {
> > for (i = 0; i < obj2->nodesetval->nodeNr; i++) {
> > valuePush(ctxt, xmlXPathObjectCopy(obj1));
> > valuePush(ctxt,
> > xmlXPathNewNodeSet(obj2->nodesetval->nodeTab[i]));
>
> Add this:
> xmlXPathStringFunction(ctxt, 1);
> here, this should do the trick for now (maybe it'd be better to use
> xmlXPathConvertString?)
-------------------------------------------------------------------------
"The programmer, like the poet, works only slightly removed from pure
thought-stuff. He builds his castles in the air, from air, creating
by exertion of the imagination. Few media of creation are so
flexible, so easy to polish and rework, so readily capable of
realizing grand conceptual structures."
-- Frederick Brooks, Jr., The Mythical Man Month
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]