RE: [xslt] crash in libxslt 1.0.9

I was entering a bug as I received this email  :)

>   I think the problem is called "dynamic code generation".
> Basically exslt:function now allows to dynamically extend the XSLT
> code at run-time. Everything looked fine because the new document 
> were also kept in the document list which is kept im memory till the
> end of the processing.

Not sure why you mention exsl:function as that isn't used anywhere, just

>   However in the failing case it seems the exslt:function new code is
> built from a volatile copy of a global variable. So basically when the
> variable is deallocated some part needed for the processing of the
> code have disapeared, are deallocated and points to random data :-(
>   The solution is to build a copy of the tree and process the code
> "compilation" from the copy of that tree and keep it as part of the
> extension function data. I will try to do this before the next release
> and hope it fixes the problem.

I have been digging in trying to figure this out, and simplified the source
stylesheet a little bit.  Attached are two stylesheets (replacements for
style.xsl), broken.xsl and works.xsl.  They are nearly identical, except

-- in broken.xsl --
<xsl:variable name="var">
  stuff (see attachment for complete)
<xsl:apply-templates select="exsl:node-set($var)"/>

-- in works.xsl
<xsl:variable name="var">
  stuff (see attachment for complete)
<xsl:variable name="var2" select="exsl:node-set($var)"/>
<xsl:apply-templates select="$var2"/>

I will continue to dig around to hopefully find an answer as I use this
'dynamic' approach in many stylesheets.  Do you have any pointers where to
begin looking (this is, why the two examples behave differently?)




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