[lxml-dev] custom resolver, why does system url start with XSLT:?

Brad Clements bkc at murkworks.com
Mon Oct 15 20:18:46 CEST 2007


I have a project (XSL based TAL) that has used libxml2 and libxslt for a 
couple of years. I have a custom resolver that has worked "ok" with this.

Now I have converted the project to use lxml. I am creating a parser and 
adding my resolver.

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>

(the 2nd one is not mangled, looks ok to me)

What's the story with XSLT:// being stuck on the front of the system urls?

I don't see that happen when I use libxml2 directly.

I tried looking through the lxml source to find this, but I couldn't 
find it in docloader, parser, or xslt.

where is the XSLT scheme coming from, is it lxml or libxslt?

Why is it being inserted?


The last example url, comes from using document() in a stylesheet, (the 
converted form of this:)

<option tal:repeat="account 
document('/services/+payment_accounts')/data/accounts/item"
   tal:attributes="value $account/id"
   tal:content="concat($account/name, ' ($', $account/currency, ')')" />


I expect my resolver to get a system url of '/services/+payment_accounts'

The 2nd example url above (the non-mangled one), also comes from a 
document call, like this:

<tal:block tal:omit-tag="" tal:repeat="tab  
document($const/@secondary_navigation)/root/tab">

Maybe the difference is due to one document() using a constant string, 
the other using a variable..?



I am using 2.0 alpha4 and 2.0 alpha 3  (two different systems, same 
problem). I can't see how from lxml to tell you which version of libxml2 
and libxslt I am using.



(the .xsl that is the converted from of the above TAL statements has 
these statements)

<xsl_:for-each 
select="document('/services/+payment_accounts')/data/accounts/item">

<xsl_:for-each select="document($const/@secondary_navigation)/root/tab">


Thanks for any suggestions!

-- 
Brad Clements,                bkc at murkworks.com    (315)268-1000
http://www.murkworks.com                          
AOL-IM: BKClements



More information about the lxml-dev mailing list