Re: [xslt] Release of libxslt-1.1.3



Good day!
A change in xsltApplyTemplates (transform.c) did bite me. I was 
replacing some nodes from the source documents by brand new nodes 
within a Python extension function. (I suspect my problem was not 
Python-specific, however.) I was using libxml2.newNode() to create 
these nodes, which I retured as a list of nodes, probably equivalent to 
a nodeset. This means that those nodes did not have a document.

At line 3142 sq of transform.c, you look at the document's name
3142                    if ((list != NULL) && (ctxt->document->keys != 
NULL)) {
3143                        if ((list->nodeNr != 0) &&
3144                            (xmlStrEqual((xmlChar 
*)list->nodeTab[0]->doc->name,
3145                               (const xmlChar *) " fake node 
libxslt")) &&

In my case, list->nodeTab[0]->doc is NULL. I suspect I was misusing the 
API, but I would have liked learning about it in a way other than a 
segfault ;-)
I got out this situation by setting the new nodes' document to the 
source document, a blatant lie, but it made libxslt happy.
Maybe there is a proper protocol for inserting source nodes which I do 
not know about; maybe there should be a xsl-oriented variant of  
xmlNewNode which would insert the "fake node libxslt" pseudo-document; 
maybe it is a bad idea in the first place...
But I thought you should know about this possibility.

Marc-Antoine Parent




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