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

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.


regards, Jørgen

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