Re: [xslt] XML_DOCUMENT_NODE and boolean testing
- From: Phil Shafer <phil juniper net>
- To: veillard redhat com, The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] XML_DOCUMENT_NODE and boolean testing
- Date: Fri, 11 Jul 2008 09:32:21 -0400
Daniel Veillard writes:
> maybe it's a bug, yes.
This seems to fix it:
Index: libxml2/xpath.c
===================================================================
RCS file: /cvs/junos-2001/src/contrib/libxml2/xpath.c,v
retrieving revision 1.8
diff -u -p -r1.8 xpath.c
--- libxml2/xpath.c 3 Apr 2008 21:26:20 -0000 1.8
+++ libxml2/xpath.c 11 Jul 2008 13:33:51 -0000
@@ -5940,6 +5940,16 @@ int
xmlXPathCastNodeSetToBoolean (xmlNodeSetPtr ns) {
if ((ns == NULL) || (ns->nodeNr == 0))
return(0);
+ /*
+ * If the only contents of the node-set are an
+ * XML_DOCUMENT_NODE, then we have a fake document
+ * returned by a template. If it's empty, the
+ * boolean value should be false.
+ */
+ if ((ns->nodeNr == 1)
+ && (ns->nodeTab[0]->type == XML_DOCUMENT_NODE)
+ && (ns->nodeTab[0]->children == NULL))
+ return(0);
return(1);
}
I'll open a bug report with this patch.
Thanks,
Phil
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]