Extension Elements/Functions can only return XML nodes in node sets.

Bug #446654 reported by John Krukoff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Wishlist
scoder

Bug Description

XPath/XSLT extension functions/elements can only return XML nodes for extension elements, but can accept a wider range of inputs. For instance, with a simple echo extension function:

def extension( context, input ):
    return input

A "This is not a node" error is raised for a node set selection that includes text nodes (i.e. "//text()"). Ideally, extension functions should be able to return data of any type they accept. Tested with lxml 2.2.2.

Discussed on the mailing list here:
http://codespeak.net/pipermail/lxml-dev/2009-October/004939.html

Revision history for this message
scoder (scoder) wrote :

Implemented for strings in trunk rev. 68558:

https://codespeak.net/viewvc/?view=rev&revision=68558

Numbers and booleans are trickier as they would have to pass through string values. It's not clear to me how to make this work nicely. I think strings are the most important use case anyway.

Changed in lxml:
assignee: nobody → Stefan Behnel (scoder)
importance: Undecided → Wishlist
milestone: none → 2.3
status: New → Fix Committed
Revision history for this message
John Krukoff (jkrukoff) wrote :

Well, strings are certainly the use case I have, so no complaints here. Thanks for the quick addition!

Revision history for this message
scoder (scoder) wrote :

Fixed in lxml 2.3alpha1.

Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.