Hi, > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Daniel Veillard
> On Tue, Jul 04, 2006 at 01:02:35PM +0200, Buchcik, Kasimier wrote: > > Hi, > > > > I learned from the sources that Result Tree Fragments, which > > are stored in XPath objects are not freed anymore in the > > XPath module itself but freed on Libxslt's side. > > There are several comments in the code like: > > "Freeing is not handled there anymore" > > Therefore the @boolval field of an XPath object is set to 0, > > after creation of such an object. > > > > Should we change xmlXPathNewValueTree() in order not to set > > the @boolval field to 1? Setting it to 1 indicated that > > xmlXPathFreeObject() should free the Result Tree Fragment > > via xmlXPathFreeValueTree(). > > Hum, maybe this makes sense, but in that case the > instructions should > be given in that function description on how to get the RVT cleaned up > properly in the XSLT context. And maybe add a warning that > this must be used within XSLT only. > > Daniel A bit more info on the usage of such wrapped RTFs in Libxslt/Libexslt. The sequence is always the following: 1) Create the Result Tree Fragment: container = xsltCreateRVT(ctxt); 2) Let the RTF be managed by the transformation context: xsltRegisterTmpRVT(ctxt, container); 3) Wrap the RTF with an XPath object: result = xmlXPathNewValueTree((xmlNodePtr) container); This is then either pushed as a result into the XPath machinery (in Libexslt) or reflect the value of an XSLT varibale/parameter. Registered RTFs are then freed on every exit of xsltApplyOneTemplate(). This means that the lifetime of RTFs is managed by Libxslt itself. This might be also the reason why there's no "free" function for RTFs yet. Regards, Kasimier _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ [email protected] http://mail.gnome.org/mailman/listinfo/xslt
