Re: Perl Bindings
Daniel Veillard <[email protected]> Tue, 14 Jan 2003 08:07:09 -0500
| Newsgroups | gmane.comp.gnome.lib.xml.bindings |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jan 14, 2003 at 12:48:00PM +0000, [email protected] wrote: > Hi, > > Has anyone implemented the xsltRegisterExtModuleElement function in Perl or > Python? I worked on xsltRegisterExtModuleFunction yesterday, but didn't touched the Element stuff... http://bugzilla.gnome.org/show_bug.cgi?id=101602 > It certainly hasn't for Perl. Is anyone going to do this because I have > a need to use it. I hope I'm not stepping on anyone's toes by volunteering to > extend the interface for elements. If it's OK for me to go ahead, I was For python please check first the code in CVS, for Perl you should check with AXKit/XML::LibXSLT maintainers, Matt seems to follow the main libxslt list. > wondering if anyone might be able to clarify a few (dumb) questions for me: > > 1. The binding uses xsltRegisterExtModuleFunction instead of > xsltRegisterExtFunction. What is the difference btn the > module functions and the "simpler" functions? Hum, the module have the capacity to run specific code at stylesheet and/or transformation startup and end. But in the existing current bindings that was not significant (and was broken in practice anyway). > 2. The signature for xsltRegisterExtModuleElement looks like this: > > int xsltRegisterExtModuleElement (const xmlChar *name, > const xmlChar *URI, > xsltPreComputeFunction precomp, > xsltTransformFunction transform); > > Whats a PreCompute function? I could find it defined on the website? the xsltPreComputeFunction is called at stylesheet compilation time. Once compiled the stylesheet must not be modified by running transformations and a lot of things are better done at that step than on each executions. The compilation process is described at http://xmlsoft.org/XSLT/internals.html#XSLT1 > Is it > another registered function? Could I use the generic function that's already in > XS file? You probably want to be able to register specific functions for those. This will probably not be a trivial task... > The last argument - the transform - is presumably the one I want to do my work > with...could I create a function with the xsltTransformFunction signature and > pass that? Yes you will have to. And then register the associated python/perl callback associated to the class . It's not trivial, have a look at python/libxslt.c > BTW, the XML::libXSLT module is now in CPAN. Matt must be happy :-) Daniel -- Daniel Veillard | Red Hat Network https://rhn.redhat.com/ [email protected] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/