Re: [xslt] XSLT Document Handling Question
- From: Daniel Veillard <veillard redhat com>
- To: xslt gnome org
- Subject: Re: [xslt] XSLT Document Handling Question
- Date: Sat, 15 Jun 2002 08:55:13 -0400
On Fri, Jun 14, 2002 at 02:16:23PM -0600, Vakoc, Mark wrote:
>
> 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?
Well, in general no. It really depends on the stylesheet processing though,
if there are variables which still holds nodeset pointing to elements in the
document tree, then that can lead to a crash later. On the other hand if you
are sure the stylesheet don't keep informations pertaining to the document,
then that should be fine.
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]