Re: [xslt] Python extension functions -- accessing args
- From: Matthew Patterson <list-matt reprocessed org>
- To: xslt gnome org
- Subject: Re: [xslt] Python extension functions -- accessing args
- Date: Fri, 12 Mar 2004 14:56:43 +0000
On 5 Mar 2004, at 07:19, Phil Frost wrote:
> I've been trying to write some extension functions using python, and
> ... I'm not sure how to get at the contents of the
> "bar" element.
There's a good example of how to do this over at Kimbro Staken's weblog:
http://www.xmldatabases.org/WK/blog/
240_libxslt_Extension_Functions_in_Python.item
> As I can tell, if the parameter is a node, returned is a PyCObject
> which looks like a list with one child PyCObject with no methods. Any
> help is much appreciated.
A couple of brief things to help: if the parameter is an xpath then a
nodelist (if there's only one matching node then you get a single-item
list) is passed in. The PyCObjects are 'raw' objects coming out of
libxslt. The first thing you need to do is make them into proper
libxslt/Python node objects: this is all explained in Kimbro's post.
You could also join the Python/XML mailing list: there are several
other users of libxslt's python bindings there.
Best,
Matt
--
Matt Patterson | Design & Code
<matt@emdash.co.uk> | http://www.emdash.co.uk/
<matt@reprocessed.org> | http://www.reprocessed.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]