Re: [xml] Problem with xsltParseStylesheetImportedDoc /xsltGatherNamespaces



Hi, 

-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On 
Behalf Of Christopher R. Palmer
Hi,

I just upgraded to libxslt-1.1.17 and found what appears to 
be a bug in the 
the stylesheet creation.  In version 1.1.15, the code in 
xsltParseStylesheetImportedDoc was:

     ...
     ret->doc = doc;
     ret->parent = style;        /* needed to prevent loops */
     xsltGatherNamespaces(ret);
     ...

and the current code (removing the ifdefs) is:

     retStyle->parent = parentStyle;
     ...
     xsltGatherNamespaces(retStyle);
     retStyle->doc = doc;

In xsltGatherNamespaces, it collects all the namespaces from 
the ->doc 
which it can no longer do because the doc has not been set 
before calling it.

The attached patch fixes the problem by setting the doc 
before calling the 
gather function.  I included an #ifndef on the assumption 
that it should 
not be set in the new refactoring code (but that was just a guess).

Yes, the xsltGatherNamespaces() function is not needed in
the refactored code paths.

The fact that this bug (I'm pretty sure it was me who
invented this bug) in the normal code paths survived the
regression tests, should encourage us to get rid of
calling xsltGatherNamespaces(), as its usage restricts the
stylesheet to have distinct prefixes; i.e., it disallows
a specific prefix to be bound to different namespace names.

Could you compile and send the scenario where the current
behaviour (no build of a namespace-hash) produces problems?
Maybe we can fix your issue without usage of the namespace
hash.

(by the way: please direct Libxslt-related issues to xslt gnome org)

Regards,

Kasimier




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