[lxml-dev] Failure with custom resolvers and relative xsl:import

Stefan Behnel stefan_ml at behnel.de
Mon Aug 18 09:04:58 CEST 2008


Hi,

Sidnei da Silva wrote:
> I've got a reproducible failing test when using custom resolvers and
> relative xsl:import. Basically, if I use resolve_string() or let the
> default resolver do it's work, everything works fine. If I use
> resolve_file though, the *next* uri to be resolved will have a
> relative (to the previous uri resolved) filename, and then there's not
> enough information available to compute the full URI.

The problem here is that lxml currently only takes the .name attribute of a
file object to determine the file name. The right thing to do would be to use
os.path.abspath(f.name) instead to retrieve the absolute path name of the file.

Using resolve_filename(filename) instead of resolve_file(open(filename))
provides a more efficient work around, though.

Stefan




More information about the lxml-dev mailing list