[xslt] Result Tree Fragments



Hi Daniel, all,

I'm trying to debug the bug I entered:  http://bugzilla.gnome.org/show_bug.cgi?id=110023

It appears that you have changed the method for managing result tree fragments.  It appears that any extension functions that return a result tree fragment need to be modified, including str:tokenize() and such.

Before the container node for the result tree fragment (rtf) nodes was a child of the source document so the nodes would get free'd when the document is free'd.  Under the new system when would the nodes contained in the RTF ever get freed?  Do I need to modify all my extension functions that return a RTF to use this new method?  If so str:tokenize and any other extensions that return a RTF need to be modified as well?

	} else {
	    /*
	     * This is a result tree fragment.
	     */
	    xmlDocPtr container;
	    xmlNodePtr oldInsert;
	    xmlDocPtr  oldoutput;

	    container = xmlNewDoc(NULL);
	    if (container == NULL)
		return(NULL);
	    container->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
	    container->doc = container;
	    container->parent = NULL;

	    oldoutput = ctxt->output;
	    ctxt->output = container;
	    oldInsert = ctxt->insert;
	    ctxt->insert = (xmlNodePtr) container;
	    xsltApplyOneTemplate(ctxt, ctxt->node, elem->tree, NULL, NULL);
	    ctxt->insert = oldInsert;
	    ctxt->output = oldoutput;

	    result = xmlXPathNewValueTree((xmlNodePtr) container);
	    if (result == NULL) {
		result = xmlXPathNewCString("");
	    } else {
		/*
		 * Tag the subtree for removal once consumed
		 */
		result->boolval = 1;
	    }
#ifdef WITH_XSLT_DEBUG_VARIABLE
#ifdef LIBXML_DEBUG_ENABLED
	    if ((xsltGenericDebugContext == stdout) ||
		(xsltGenericDebugContext == stderr))
		xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
					result, 0);
#endif
#endif
	}



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