[lxml-dev] Failure with custom resolvers and relative xsl:import
Stefan Behnel
stefan_ml at behnel.de
Wed Aug 6 08:43:43 CEST 2008
Hi,
I'll look into this when I find the time, but as a quick comment on your code:
Sidnei da Silva wrote:
> ...
> def resolve(self, uri, id, ctx):
> print uri
> # return None # works
> # return self.resolve_string(open(uri, 'r').read(), ctx) # works
> return self.resolve_file(open(uri, 'r'), ctx) # fails
> ...
This should read (mind the 'rb'):
return self.resolve_file(open(uri, 'rb'), ctx)
There's also
return self.resolve_filename(uri, ctx)
which tends to be a lot more efficient (at least before 2.1) and works for
file names and HTTP/FTP URLs.
Stefan
More information about the lxml-dev
mailing list