Re: [xslt] Extensions functions will modify the stylesheet at transformation-time



On Tue, May 02, 2006 at 09:00:07PM +0200, Buchcik, Kasimier wrote:
> Hi,
> 
> Extension functions will modify the compiled-stylesheet at
> transformation-time in certain scenarios.
> 
> Example:
> 
> <?xml version='1.0'?>
> <xsl:stylesheet
>   version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>   xmlns:libxslt="http://xmlsoft.org/XSLT/";>
> 
>   <xsl:template match="/">
>     <xsl:value-of select="libxslt:test('SUCCESS')"/>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> The above example will generate the following
> callstack:
> 
> ... -->
> xmlXPathCompOpEval() -->
>  xsltExtFunctionTest() -->
>   xsltGetExtData() -->
>    xsltExtInitTest() -->
>     xsltStyleGetExtData():
> 
> xsltStyleGetExtData() will modify the stylesheet's @extInfos field:
> 
>   1) style->extInfos = xmlHashCreate(10);
>   2) if (xmlHashAddEntry(style->extInfos, URI, (void *) data) < 0)
> 
> I think this could lead to race conditions in multithreaded
> scenarios using precompiled stylesheets.
> We need to change this somehow to avoid modifying the stylesheet
> at transformation-time.
> 
> Does anyone know if this is a known issue?

  Hum, looks right :-\ . Unfortunately you can't precompile this as the
extensions may be found only dynamically, unless you change the binding
to be forced at compile time (assuming I understood correctly).

> Is someone into
> that part of code?

  you :-)

Daniel

-- 
Daniel Veillard      | Red Hat 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]