Re: [xslt] Status of python extensions?



On Tue, Jun 11, 2002 at 01:32:21PM +0200, Eric van der Vlist wrote:
> Daniel,
> 
> Daniel Veillard wrote:
> > On Mon, Jun 10, 2002 at 04:30:22PM -0400, Norman Walsh wrote:
> > 
> >>What's the status of python extensions in xsltproc? Can I consume and
> >>produce new result tree fragments yet?
> > 
> > 
> >   yes,
> > 
> > on input, the nodesets are received as an array of python libxml2.xmlCore
> > class instances (well that's what I expect to happen).
> > 
> > on output the main problem is if you generate new nodes to find a way to
> > deallocate them. Since you have a gnome-xml checkout, look at 
> >     python/tests/xpathret.py
> > basically the new nodes created in the foo() extension function
> > are kept in a new document, which in turn is freed at the end of the
> > processing.
> 
> Thanks for the pointer which gave me the missing pieces for my HTML 
> problem :-)

  Hum, right, if you're in a Python frameworkdoing an extension function
like document() but working on HTML should be relatively simple.

> I have a couple of related questions...
> 
> 1) What is the link between the libxml2-python and the python bindings 
> available under libxml2 and libxslt? They seem to be close if not 
> identical...

  Let's say it's a packaging divergence. For the RPM distribution I really
want separate packages libxml2-python and libxslt-python, but in the general
case the libxml2-python tarball contains both modules, packaged the python
way (with the setup.py) which will generate both modules at once (this also
allows to avoid some really nasty troubles related to double loading of shared
libraries on some platforms too).
  If you use linux and your distro provides libxml2-python and libxslt-python
then use them, otherwise grab the libxml2-python tarball and install it.

> 2) How do you register EXSLT extensions in python? I have seen in a 
> comment of pyxsltproc.py that:
> 
> # TODO libxslt.exsltRegisterAll();
> 
> However, a naive:
> 
> libxslt.registerExtModuleFunction("node-set", "http://exslt.org/common";, 
> libxslt.libxsltmod.xsltFunctionNodeSet)
> 
> gives a run time error. What's the correct way to register these functions?

  Right, that part is giving me some headache, yet another shared library
to integrate, unfortunately it's not yet done, unfortunately this lower the
interest of the python bindings, this would have to be done in
   libxslt/python/libxslt.c
within the initialization routine initlibxsltmod() but also requires to 
add the dependancy to the libexslt shared library in a couple of places.
  The unfortunate point is that if writing the code is usually simple,
making sure it's portable and won't break on a zillion platform is a problem
and since we are in a very last sequence of freeze for Gnome-2.0 I'd prefer
not to play with this right now. but wait a litlle for the release before
starting adventurous things like this. Maybe in a couple of weeks.

> See you in San Diego.

  Sure,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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