Bug 582887 – problems validating complex schemas

* xmlschemas.c: fixes the problem faced when importing the same schemas
  multiple times but from different places which is allowed
* test/schemas/582887* result/schemas/582887*: adding the specific test
  to the regressions
diff --git a/test/schemas/582887-element.xsd b/test/schemas/582887-element.xsd
new file mode 100644
index 0000000..0562021
--- /dev/null
+++ b/test/schemas/582887-element.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	   xmlns="http://www.example.org/test-import-case"
+	   targetNamespace="http://www.example.org/test-import-case">
+  <xs:include schemaLocation="./582887-common.xsd" />
+
+  <xs:complexType name="test-element">
+    <xs:attribute name="test-attribute" type="test-attribute" />
+  </xs:complexType>
+  <xs:element name="test-element" type="test-element" />
+</xs:schema>