Re: [xslt] str:tokenize behavior



On Thu, Apr 24, 2003 at 11:09:31AM -0600, Vakoc, Mark wrote:
> >   Hum, there is 2 options:
> >     - either this must behave like a node set, an in this case the
> >       nodeset should contain the list of nodes not, the 
> > parent document
> >       element

  Okay I finally addressed this in what I think is the correct way.
1/ this is expected to be a node set, so it should allocated as such
2/ the problem of freeing the tree is independant and addressed by
   allocating and freeing it with new APIs

 Basically it becomes:

------------------------
    ... we need a pointer to the transformation context now ...
    xsltTransformContextPtr tctxt;
    ...
    tctxt = xsltXPathGetTransformContext(ctxt);
    if (tctxt == NULL) {
        xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
              "exslt:tokenize : internal error tctxt == NULL\n");
        goto fail;
    }
                                                                                
    container = xsltCreateRVT(tctxt);
    if (container != NULL) {
        xsltRegisterTmpRVT(tctxt, container);
        ret = xmlXPathNewNodeSet(NULL);
        if (ret != NULL) {
            ret->boolval = 0; /* Freeing is not handled there anymore */

.... and within the loop .....
                        xmlXPathNodeSetAddUnique(ret->nodesetval, node);
------------------------

  The XSLT processor exports new APIs to create a result value tree
and register it in the transformation context. When getting out of scope
old RVT are freed automatically by the XSLT processor. This should 
clean things up a lot and finally give a good fondation for handling
result value trees and functions creating temporary trees.

  I commited this to CVS, and added your test case to the exslt regression
tests. I will be out of IP connectivity till Sunday, and I will try to make
a release then. In the meantime could you check it out and verify that
this code allows to rewrite your extensions functions in a clean (and
possibly simpler) way ? 

    thanks

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]