[lxml-dev] custom resolver, why does system url start with XSLT:?
Stefan Behnel
stefan_ml at behnel.de
Fri Oct 19 14:13:08 CEST 2007
Hi,
Brad Clements wrote:
> when my resolver gets called, the URIs are weirdly mangled like this:
>
> resolve url 'XSLT:///xml/navigation.xml' id None ctext
> <lxml.etree._XSLTResolverContext object at 0xb6a5353c>
>
> resolve url '/xml/carrier_payables_navigation.xml' id None ctext
> <lxml.etree._XSLTResolverContext object at 0xb6a5353c>
>
> resolve url 'XSLT:///services/+payment_accounts' id None ctext
> <lxml.etree._XSLTResolverContext object at 0xb6a5353c>
If you are you parsing your stylesheets from a string, without providing a
URL, lxml will come up with a fake URL-like string to make sure we can
identify the stylesheet on request. I think what happens here is that libxml2
parses that string and extracts what it understands of it to prepend it to the
relative path of the referenced document.
If you provide a "base_url" to parse() or XML() in lxml 1.3.x or later, you
can prevent lxml from having to do that. Also, when you parse the stylesheet
from a URL or a file instead of a string, you should not have this problem.
Still, I will see if I can change this somehow.
Stefan
More information about the lxml-dev
mailing list