[xslt] wrong res->last in resulting document?



Hello, 
  applying the attached stylesheet to the attached document leads
the correct output. However, both from xsltproc and my own application,
from the gdb output below, I can see res->children == res->last, 
but res->children->next != NULL and res->children->next != res->last.

  This implies that if I later call:

    xmlAddChild((xmlNodePtr)res, newnode)

  newnode gets attached right after res->children, replacing
the real res->children->next, which is then lost in memory
and not outputted anymore if I then dump the document.

  I believe the correct res should have res->last=res->children->next 
instead of res->last=res->children.

  This error verifies only if the following conditions are met:
  	method="xml"
	doctype-public=".."
	doctype-system=".."
  if method is not xml, either doctype-public or system are not
set, the result is correct. I couldn't trace the problem
any further. 

libxml: 2.6.11
libxslt: 1.1.8 

I don't have any newer version of libxslt at hand. Sorry if
this bug has already been corrected.

Cheers,
Carlo

(gdb) n
4195        if ((ctxt != NULL) && (ctxt->state == XSLT_STATE_ERROR)) {
(gdb) n
4199        if ((res != NULL) && (ctxt != NULL) && (output != NULL)) {
(gdb) n
4214        if ((ctxt != NULL) && (userCtxt == NULL))
(gdb)
4217        return (res);
(gdb)
4225    }
(gdb)
xsltApplyStylesheetUser (style=0x8057438, doc=0x8058b30, params=0x804d360, output=0x0, profile=0x0, userCtxt=0x80584f8)
    at transform.c:4290
4290        return (res);
(gdb)
4291    }
(gdb)
xsltProcess (doc=0x8058b30, cur=0x8057438, filename=0xbffff90f "./index.xml") at xsltproc.c:425
(gdb) p res
$19 = 0x8053af0
(gdb) p *res
$20 = {_private = 0x0, type = XML_DOCUMENT_NODE, name = 0x0, children = 0x8053df8, last = 0x8053df8, parent = 0x0, next = 0x0,
  prev = 0x0, doc = 0x8053af0, compression = -1, standalone = -1, intSubset = 0x8053df8, extSubset = 0x0, oldNs = 0x0,
  version = 0x8053b50 "1.0", encoding = 0x0, ids = 0x0, refs = 0x0, URL = 0x0, charset = 1, dict = 0x80532c8, psvi = 0x0}
*(gdb) p *res->children
$21 = {_private = 0x0, type = XML_DTD_NODE, name = 0x8053e40 "html", children = 0x0, last = 0x0, parent = 0x8053af0,
  next = 0x8053d58, prev = 0x0, doc = 0x8053af0, ns = 0x0, content = 0x0, properties = 0x0, nsDef = 0x0, psvi = 0x8053e50,
  line = 15992, extra = 2053}
*(gdb) p *res->children->next
$22 = {_private = 0x0, type = XML_ELEMENT_NODE, name = 0x8053d98 "html", children = 0x8053da8, last = 0x8053da8,
  parent = 0x8053af0, next = 0x0, prev = 0x0, doc = 0x8053af0, ns = 0x0, content = 0x0, properties = 0x0, nsDef = 0x0,
  psvi = 0x0, line = 7, extra = 0}
*(gdb) p *res->children->next->next
Cannot access memory at address 0x0

-- 
  GPG Fingerprint: 2383 7B14 4D08 53A4 2C1A CA29 9E98 5431 1A68 6975
                        -------------
They are called computers simply because computation is the only significant
job that has so far been given to them.

Attachment: index.xml
Description: application/xml

Attachment: site.xsl
Description: application/xml



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