Re: [xslt] output-method='text' -- strange behavior
- From: Daniel Veillard <veillard redhat com>
- To: "Anton V. Boyarshinov" <boyarsh ru echo fr>
- Cc: xslt gnome org
- Subject: Re: [xslt] output-method='text' -- strange behavior
- Date: Tue, 17 Apr 2001 07:03:32 -0400
> When output method is text nothing outputed :-(
> For this XML/XSL output method is not very importent, but we have many
> big stylesheets, which needs output-method='text'.
>
> I using libxslt 0.7.0, libxml 2.2.9 on RedHat Linux 6.2.
>
> Any comments?
I don't know how you managed to install libxslt 0.7.0 against
libxml 2.2.9, the configure checks for having at least 2.3.6 installed
and really needs it ! First thing to do is to double-check this.
Considering the bug, you are right, libxslt wasn't recursing withi
the result to find the text nodes. Here is the document generated
by your example:
orchis:~/XSLT/libxslt -> ./xsltproc --debug tst.xsl tst.xml
DOCUMENT
version=1.0
encoding=iso-8859-1
standalone=true
TEXT
content=
ELEMENT font
ATTRIBUTE color
TEXT
content=#ff0000
ATTRIBUTE size
TEXT
content=+1
TEXT
content=This values are missed or incorrect: ...
TEXT
content=
orchis:~/XSLT/libxslt ->
And the result once the attached patch is applied:
orchis:~/XSLT/libxslt -> ./xsltproc tst.xsl tst.xml
#ff0000+1This values are missed or incorrect:
address, folder.
orchis:~/XSLT/libxslt ->
thanks for the report,
Daniel
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
*** xsltutils.c 2001/04/12 12:33:23 1.23
--- xsltutils.c 2001/04/17 11:02:13
*************** xsltSaveResultTo(xmlOutputBufferPtr buf,
*** 339,349 ****
(xmlStrEqual(method, (const xmlChar *) "text"))) {
xmlNodePtr cur;
cur = result->children;
while (cur != NULL) {
if (cur->type == XML_TEXT_NODE)
xmlOutputBufferWriteString(buf, (const char *) cur->content);
! cur = cur->next;
}
} else {
int omitXmlDecl;
--- 339,376 ----
(xmlStrEqual(method, (const xmlChar *) "text"))) {
xmlNodePtr cur;
+ /*
+ * Walk the full document tree, outputting all text nodes
+ */
cur = result->children;
while (cur != NULL) {
+ if (cur->properties != NULL) {
+ xmlAttrPtr att = cur->properties;
+ while (att != NULL) {
+ if ((att->children != NULL) &&
+ (att->children->type == XML_TEXT_NODE))
+ xmlOutputBufferWriteString(buf,
+ (const char *) att->children->content);
+ att = att->next;
+ }
+ }
if (cur->type == XML_TEXT_NODE)
xmlOutputBufferWriteString(buf, (const char *) cur->content);
!
! if (cur->children != NULL)
! cur = cur->children;
! else if (cur->next != NULL) cur = cur->next;
! else do {
! cur = cur->parent;
! if (cur == result)
! cur = NULL;
! if (cur == NULL)
! break;
! if (cur->next != NULL) {
! cur = cur->next;
! break;
! }
! } while (cur != NULL);
}
} else {
int omitXmlDecl;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]