[lxml-dev] document('') and custom resolver not working again/still

Stefan Behnel stefan_ml at behnel.de
Sun Jan 27 22:35:37 CET 2008


Hi,

Brad Clements wrote:
> I am stumped. Probably doing something stupid but I just cannot get
> document('') to work with lxml, but it does work when the .xsl is sent
> to the browser (ff) and it does work with xsltproc
> 
> I think there's been a change in libxslt at some point, but I don't know
> exactly what changed.
> 
> This deployment works:
> 
> RHEL4 linux with libxml2 2.6.27 and libxslt 1.1.18, with lxml 2 alpha4
> 
> this deployment does not work:
> 
> Centos 4 with libxml2 2.6.28 and libxslt 1.1.19 with lxml 2 alpha 3
> 
> So I upgraded to libxml2 2.6.30, libxslt 1.1.22 and lxml 2 beta 2
> But it still doesn't work correctly.

Hmm, I can't see why it should be a problem with the libxslt version. The test
cases we have for document('') work for all versions from 1.1.15-22.


> I am passing a base_url when creating documents using etree.fromstring

That should not make a difference. The stylesheet is given its own name and
resolved internally and thus outside the custom resolver scope.


> I've traced the execution of document('') via gdb, both in
> libxslt/functions.c and libxslt/documents.c
[...]
> I'm stumped  that it works with older versions of libxslt, works with
> client-side transform, and works with xsltproc, but not through lxml
> with "newer libxslt"

This means you traced it in xsltproc, not in lxml, right? Could you run the
debugger on your script in lxml and look at lines 78-82 in src/lxml/xslt.pxi
(or somewhere around line 81023 in lxml.etree.c), where it says "# shortcut if
we resolve the stylesheet itself"? I would like to know what "__pyx_v_c_uri"
and "__pyx_v_c_doc.URL" (or c_uri and c_doc.URI respectively) are in your case.

It would be great if you could figure that out, as I won't have much time to
look into this next week.

Stefan



More information about the lxml-dev mailing list