XSLT extension: process_children

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/

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:
-- Jens Tröger http://savage.light-speed.de/

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:
-- Jens Tröger http://savage.light-speed.de/

Jens Tröger schrieb am 06.04.2015 um 23:56:
Latest master has a bug fix, but now I'm getting random failures of the newly added test (which didn't work before at all), every so many runs. It's currently unclear to me why it's failing, so I'd be happy if you could investigate this a bit. https://github.com/lxml/lxml/blob/06ae415eda3ebd6eef09d5fbe52b130f2a51c81e/s... The symptom is that the text content that the test code constructs is sometimes incomplete and contains only "This is * text" instead of "This is *-arbitrary-* text". Here for example: https://travis-ci.org/lxml/lxml/jobs/58890120 Stefan

Hi, As a follow-up: I could avoid this bug by using XPath extension functions in my XSLT stylesheet. Works just fine :) Jens On Mon, Apr 06, 2015 at 11:56:16PM +0200, Jens Tröger wrote:
-- Jens Tröger http://savage.light-speed.de/

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:
-- Jens Tröger http://savage.light-speed.de/

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:
-- Jens Tröger http://savage.light-speed.de/

Jens Tröger schrieb am 06.04.2015 um 23:56:
Latest master has a bug fix, but now I'm getting random failures of the newly added test (which didn't work before at all), every so many runs. It's currently unclear to me why it's failing, so I'd be happy if you could investigate this a bit. https://github.com/lxml/lxml/blob/06ae415eda3ebd6eef09d5fbe52b130f2a51c81e/s... The symptom is that the text content that the test code constructs is sometimes incomplete and contains only "This is * text" instead of "This is *-arbitrary-* text". Here for example: https://travis-ci.org/lxml/lxml/jobs/58890120 Stefan

Hi, As a follow-up: I could avoid this bug by using XPath extension functions in my XSLT stylesheet. Works just fine :) Jens On Mon, Apr 06, 2015 at 11:56:16PM +0200, Jens Tröger wrote:
-- Jens Tröger http://savage.light-speed.de/
participants (2)
-
Jens Tröger
-
Stefan Behnel