Re: [xml] Deep-copy of xsltStylesheetPtr?



On Sat, Sep 18, 2004 at 10:01:53AM -0700, Rasmus Lerdorf wrote:
I think I will just make use of the fact that I can cache an xmlDoc easily
and move it back and forth.  That still helps a bit as I can cache the
stylesheet xmlDoc in shared memory, xmlCopyDoc() it out into PHP
per-request memory and then xsltParseStylesheetDoc() it there.  That
leaves me with a normal stylesheet object and I don't have to worry about
something down the line trying to munge it in the wrong allocation
context.

  The only problem with that approach is that xmlCopyDoc() does not
build a dictionnary for the copied document (basically when people
start copying nodes around, dictionary links are more a big pain 
than a benefit), this mean the stylesheet compilation process won't have
an initial dictionnary to rely on. This should still work but is not
as tested as the common case.
  Another thing which should not be underestimated is that most
useful stylesheets are compound, made of multiple XML via xsl:include
or xsl:import, and those are loaded on-the-fly when compiling the 
stylesheet, they would escape your caching scheme, unless you override
the loading functions (at the libxml2 level or at the xsltSetLoaderFunc
from recent libxslt/documents.h).

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]