Re: [xslt] Python extension functions -- accessing args

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: 

>  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.



   Matt Patterson | Design & Code
   <> |
   <> |

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]