[lxml-dev] Avoiding re-parsing for document loading
Laurence Rowe
l at lrowe.co.uk
Fri Jan 30 18:08:22 CET 2009
Sadly this doesn't work:
Traceback (most recent call last):
File "blocks.py", line 72, in ?
output = render(page_path, layout_path, tile_path)
File "blocks.py", line 59, in render
layout_transform = XSLT(compiler(layout))
File "xslt.pxi", line 505, in lxml.etree.XSLT.__call__
(src/lxml/lxml.etree.c:103335)
File "lxml.etree.pyx", line 227, in
lxml.etree._ExceptionContext._raise_if_stored
(src/lxml/lxml.etree.c:6442)
File "xslt.pxi", line 90, in lxml.etree._xslt_resolve_from_python
(src/lxml/lxml.etree.c:99907)
TypeError: Cannot convert lxml.etree._ElementTree to lxml.etree._InputDocument
I have to use one of return_{filename|file|string|empty} which means
serializing the document and reparsing.
Laurence
2009/1/30 Paul Everitt <paul at agendaless.com>:
>
> http://codespeak.net/lxml/resolvers.html
>
> I believe that's what you want. If you don't mind making your XSLT bound to
> your lxml setup, you could also make custom XSLT/XPath extension functions
> that returned nodesets.
>
> --Paul
>
> On Jan 30, 2009, at 10:04 AM, Laurence Rowe wrote:
>
>> I have an XSLT that accesses a number of other documents. These other
>> documents are also created in lxml. Is there a way to pass them to my
>> stylesheet without incurring an additional parse?
>>
>> Laurence
>> _______________________________________________
>> lxml-dev mailing list
>> lxml-dev at codespeak.net
>> http://codespeak.net/mailman/listinfo/lxml-dev
>
>
More information about the lxml-dev
mailing list