[xslt] XSLT Document Handling Question
- From: "Vakoc, Mark" <Mark_Vakoc jdedwards com>
- To: "'xslt gnome org'" <xslt gnome org>
- Subject: [xslt] XSLT Document Handling Question
- Date: Fri, 14 Jun 2002 14:16:23 -0600
Hello Daniel, all,
I have an extension element that I am writing that essentialy pumps the
result of transforming it's children to a web browser, i.e
<myext:dump-to-browser>
<html>
<head><title><xsl:value-of select="/*/@title"/></title></head>
</html>
</myext:dump-to-browser>
The way I implement this is the extension element as shown below
1. Creates a new document
2. adds the document to the transform context using xsltNewDocument()
3. Changes the context->insert to the new document
4. calls xsltApplyOneTemplate on the node's children
5. restore the old insert pointer
My question is: Before I leave the extension function I want to free up the
new document as it won't be used anywhere else. Is it safe to manually
remove it from the ctxt->docList then call xmlFreeDoc? or does this doc
need to remain in the docList until it is free'ed by xsltFreeStylesheet?
Thanks,
Mark
<pseudo-code>
xmlDocPtr doc = xmlNewDoc(_X"1.0");
if (!doc) {
theLog.writeLog(nsCLog::error,"gss:int : Failed to create new
document");
return;
}
xsltNewDocument(ctxt,doc);
xmlNodePtr oldInsert;
oldInsert = ctxt->insert;
ctxt->insert = (xmlNodePtr)doc;
xsltApplyOneTemplate (ctxt, node,inst->children, NULL, NULL);
ctxt->insert = oldInsert;
</pseudo-code>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]