      if (cur == NULL)
  	return (NULL);
      if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
-@@ -8205,8 +8218,8 @@
+@@ -8207,8 +8220,8 @@
          cur = ctxt->context->node;
          if (cur == NULL)
              return (NULL);

--- misc/libxml2-2.7.6/xpath.c
+++ misc/build/libxml2-2.7.6/xpath.c
@@ -8104,9 +8104,17 @@
 xmlNodePtr
 xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);

     if (cur == NULL) return(NULL) ; /* ERROR */
     if (cur->next != NULL) return(cur->next) ;
     do {
@@ -8162,8 +8170,13 @@
 xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
 {
     if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
