Fixed #312957 reported by Carol Hunter: streaming XPath states were not

* xmlschemas.c: Fixed #312957 reported by Carol Hunter:
  streaming XPath states were not popped in every case,
  thus failed to resolve correctly for subsequent input.
* test/schemas/bug312957* result/schemas/bug312957*:
  Added the test submitted by Carol Hunter.
diff --git a/xmlschemas.c b/xmlschemas.c
index 7a016a2..1d2af17 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -19134,6 +19134,32 @@
 }
 
 /**
+ * xmlSchemaXPathPop:
+ * @vctxt: the WXS validation context
+ *
+ * Pops all XPath states.
+ *
+ * Returns 0 on success and -1 on internal errors.
+ */
+static int
+xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt)
+{
+    xmlSchemaIDCStateObjPtr sto;
+    int res;
+
+    if (vctxt->xpathStates == NULL)
+	return(0);
+    sto = vctxt->xpathStates;
+    do {
+	res = xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt);
+	if (res == -1)
+	    return (-1);
+	sto = sto->next;
+    } while (sto != NULL);
+    return(0);
+}
+
+/**
  * xmlSchemaXPathProcessHistory:
  * @vctxt: the WXS validation context
  * @type: the simple/complex type of the current node if any at all
@@ -21793,7 +21819,8 @@
 		    "calling xmlSchemaXPathEvaluate()");
 		goto internal_error;
 	    }
-	}
+	} else if (vctxt->xpathStates != NULL)
+	    xmlSchemaXPathPop(vctxt);
     }
 
     /*