Last email for now, and then I'll let people who understand the code better take a look. In the source https://github.com/lxml/lxml/blob/master/src/lxml/xsltext.pxi#L105 there is a check of output_parent for None in line 105, but not in line 111 where the crash (assert) is triggered in the callee. Should that be c_parent instead of output_parent in line 111? Ok... Let me know what's going on, but this code is not sane. Jens On Tue, Apr 07, 2015 at 12:36:44AM +0200, Jens Tröger wrote:
At the bottom of this thread:
https://mailman-mail5.webfaction.com/pipermail/lxml/2013-September/006944.ht...
is a similar mention: "process_children() does not accept None for output_element (contrary to the documentation)" Do I run into the same bug here?
Cheers, Jens
On Mon, Apr 06, 2015 at 11:56:16PM +0200, Jens Tröger wrote:
Hi,
I am trying to understand the process_children() function. If in my extension is have
def execute(self, context, self_node, input_node, output_parent): self.process_children(context, output_parent)
then processing works just fine (although I haven't done anything with the output here). However, using
def execute(self, context, self_node, input_node, output_parent): x = self.process_children(context, output_parent=None) output_parent.append(x)
crashes:
x = self.process_children(context, output_parent=None) File "xsltext.pxi", line 111, in lxml.etree.XSLTExtension.process_children (src/lxml/lxml.etree.c:164356) File "readonlytree.pxi", line 550, in lxml.etree._nonRoNodeOf (src/lxml/lxml.etree.c:78766) TypeError: invalid argument type <class 'NoneType'>
although I had assumed the two to be synonymous. I ask because I want to inject my own node and dangle children off of my own node like this:
p = lxml.etree.Element("p") p.attrib["style"] = "..." output_parent.append(p) self.process_children(context, p)
but that, too, fails. What am I doing wrong here?
Thanks! Jens
-- Jens Tröger http://savage.light-speed.de/