Re: [xslt] extension APIs returning a node-set



Le 2001.10.02 18:17, "Vakoc, Mark" a écrit :
> What is the proper method to return a node-set from an extension
> function?
> 
> I've got an extension API function that returns a potentially large
> nodeset of newly allocated nodes.  It seems that in order for these nodes
> to be properly freed I understand you have make the XPathObject ret->user
> be a node, and the nodeset be children of that node.  

Yes, that's a bit hackish but that's the way libxml/XPath is implemented.

> Libexslt (example:  str:tokenize) creates ret->user as
> xmlNewDocNode(doc,NULL,(const xmlChar*)"fake",NULL) where doc is
> retrieved from:
> xsktXPathGetTransformContext(ctxt)->output;
> 
> However, this cause a segv in xsltForEach because when processing these
> nodes xsltFindDocument() will return NULL because doc is not contained in
> xsltXPathGetTransformContext(ctxt)->docList.
[...]
> If I use doc = xsltXPathGetTransformContext(ctxt)->document->doc then
> everything works and there doesn't seem to be any memory leaks, but is
> this the correct document to add the nodes to?

Yes. The EXSLT - Strings implementation is really alpha software, thanks
for the bug reporting (yes, it should be ->document->doc, not ->output)

Tom.




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