Re: [xml-bindings]Parameter passing convention in extension functions ...



On Wed, Aug 21, 2002 at 06:54:29PM +0200, rm fabula de wrote:
> Hello list,

  Hi Ralf,

> i'm currently writing some XSLT extension functions in python
> and try to understand the calling parameter passing conventions.
> To me it seems that the parameters "arrive" at the python function
> in reverse calling order, i.e. a call to the extension function
> <xsl:value-of select='foo:bar("a", "b", "c")' /> will actually call
> the underlying python function as foo("c", "b", "a") -- nothing to
> worry about, but it should be documented, or ?

  LOL, well I never found it out because I never tested multiple argument
passing :-) . Well this ought to be fixed, really before it's too late !
Patch commited in CVS, and enclosed, could you check it fixed it ?

  http://cvs.gnome.org/bonsai/cvsquery.cgi?module=libxslt&branch=HEAD&branchtype=match&dir=libxslt&file=&filetype=match&who=veillard&whotype=match&sortby=Date&hours=&date=explicit&mindate=08%2F21%2F02+12%3A59&maxdate=08%2F21%2F02+13%3A01&cvsroot=%2Fcvs%2Fgnome

> As another question: when i call <xsl:value-of select='foo:bar(.)' />
> what is the type of the parameter. A call print in python emits
> '[<PyCObject object at 0x8189770>]' which doesn't seem to help a lot.
> Is there any way to work on/with such a parameter from within python?

  That's a problem that Norm Walsh faced too and I didn't managed to
find the problem in a 15mn debugging session, seems I really need to focuse
on this one, could you bugzilla it ?

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/
Index: python/libxslt.c
===================================================================
RCS file: /cvs/gnome/libxslt/python/libxslt.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -c -r1.12 -r1.13
*** python/libxslt.c	24 May 2002 13:03:04 -0000	1.12
--- python/libxslt.c	21 Aug 2002 17:00:38 -0000	1.13
***************
*** 107,113 ****
  
      list = PyTuple_New(nargs + 1);
      PyTuple_SetItem(list, 0, libxml_xmlXPathParserContextPtrWrap(ctxt));
!     for (i = 0;i < nargs;i++) {
  	obj = valuePop(ctxt);
  	cur = libxml_xmlXPathObjectPtrWrap(obj);
  	PyTuple_SetItem(list, i + 1, cur);
--- 107,113 ----
  
      list = PyTuple_New(nargs + 1);
      PyTuple_SetItem(list, 0, libxml_xmlXPathParserContextPtrWrap(ctxt));
!     for (i = nargs - 1;i >= 0;i--) {
  	obj = valuePop(ctxt);
  	cur = libxml_xmlXPathObjectPtrWrap(obj);
  	PyTuple_SetItem(list, i + 1, cur);


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