Re: [xml-bindings]Composing documents using Python and libxslt



On Thu, Apr 11, 2002 at 05:42:00PM +0200, Jørgen Frøjk Kjærsgaard {Metation} wrote:
> Onsdag 10. April 2002 21:38 skrev Daniel Veillard:
> > On Thu, Apr 04, 2002 at 04:12:25PM +0200, Jørgen Frøjk Kjærsgaard wrote:
> > > Hi,
> > >
> > > I need to be able to compose XML documents from Python-generated
> > > sub-ducuments. To do this I register a Python extension function using
> > > xsltRegisterExtModuleFunction().
> > >
> > > However, I am unable to create an include function, which can be used in
> > > my XML documents. Two things go wrong for some reason:
> >
> >   Well you're on the bleeding edge :-)
> 
> Ok.. I made a (temporary?) solution to the problem. I parse the document to a 
> DOM and traverse it to find all "include" tags. Each tag is replaced by the 
> corresponding sub-document. This scheme works fine, and is quite fast, too. 
> In fact, it seems to work much faster than my first Sablotron-based 
> implementation. Additionally, libxml/libxslt seems to be very stable, at 
> least I haven't been able to crash it yet.
> 
> > > 1) When the argument to the include function itself is an XPath
> > > expression, it is passed to my Python program as a list of C objects
> > > (case 1,2 in the test document below), whereas it is passed as a string
> > > if I write a string directly (case 3).
> >
> >   Yes to return a node set you would have to return a list of libxml2
> > nodes.
> 
> Hmm, are we talking about the same thing? What I mean is that a list of 
> libxml2-nodes is passed to my handler where I expected a string.
> 
> > > 2) When I attempt to apply-templates to the result of my external Python
> > > function, I get no output.
> >
> >   Hum, no idea ATM. I would have to work on debugging this.
> 
> ok

  Okay, good to know you managed to work around the problem. As stated
on the xml list I'm currently working on XML Schemas support and this
tends to drain any time I had left for python binding hacking. So if you
think there are improvements needed, I definitely take patches,

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]