[xslt] Re: [xml] xsl:value-of on empty tags
- From: Daniel Veillard <veillard redhat com>
- To: xml gnome org
- Cc: xslt gnome org, robert ilse nl
- Subject: [xslt] Re: [xml] xsl:value-of on empty tags
- Date: Wed, 7 Mar 2001 10:56:25 -0500
> I'm having problems (libxml-2.3.3, libxslt-0.4.0) processing empty tags; in
> fact, the results seem to be completely wrong.
[...]
> The output is:
> -snip-
> <?xml version="1.0"?>
> <FOO>
> <BAR>This is bar 1</BAR>
> <XXX>
> This is bar 2
> </XXX>
> <BAR>This is bar 2</BAR>
> </FOO>
> -snip-
>
> This doesn't seem to be right. If I change the xsl:value-of in the xxx-
> template to <xsl:value-of select="text()"/> (or to <xsl:apply-templates/>,
> for that matter), the output is more sane.
>
> Am I missing something here?
No, that's a bug. Or rather that was a bug, hiding in xmlNodeGetContent()
in libxml/tree.c
Enclosed patch fixes it,
Daniel
P.S: I suggest you subscribe to the xslt list
--
Daniel Veillard | Red Hat Network http://redhat.com/products/network/
veillard redhat com | libxml Gnome XML toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: tree.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/tree.c,v
retrieving revision 1.113
diff -c -r1.113 tree.c
*** tree.c 2001/02/27 21:54:07 1.113
--- tree.c 2001/03/07 15:55:32
***************
*** 3208,3213 ****
--- 3208,3216 ----
continue;
}
}
+ if (tmp == cur)
+ break;
+
if (tmp->next != NULL) {
tmp = tmp->next;
continue;
***************
*** 3217,3223 ****
tmp = tmp->parent;
if (tmp == NULL)
break;
! if (tmp == (xmlNodePtr) cur) {
tmp = NULL;
break;
}
--- 3220,3226 ----
tmp = tmp->parent;
if (tmp == NULL)
break;
! if (tmp == cur) {
tmp = NULL;
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]