fixed a bug in xmlXPathNodeTrailingSorted (for now it worked like the


	* xpath.c: fixed a bug in xmlXPathNodeTrailingSorted (for now it
	  worked like the set:leading() function)
	* include/libxml/xpathInternals.h: added xmlXPathNodeSetContains
diff --git a/xpath.c b/xpath.c
index 5404577..51899ea 100644
--- a/xpath.c
+++ b/xpath.c
@@ -2186,7 +2186,7 @@
 	return(ret);
 
     l = xmlXPathNodeSetGetLength(nodes);
-    for (i = 0; i < l; i++) {
+    for (i = l; i > 0; i--) {
 	cur = xmlXPathNodeSetItem(nodes, i);
 	if (cur == node)
 	    break;