diff -Naur a/xmlschemastypes.c b/xmlschemastypes.c
--- a/xmlschemastypes.c	2013-11-25 15:55:17.000000000 +0530
+++ b/xmlschemastypes.c	2013-11-25 15:56:10.000000000 +0530
@@ -4929,7 +4929,7 @@
 
     if (y->type == XML_SCHEMAS_STRING)
 	yws = XML_SCHEMA_WHITESPACE_PRESERVE;
-    else if (x->type == XML_SCHEMAS_NORMSTRING)
+    else if (y->type == XML_SCHEMAS_NORMSTRING)
         yws = XML_SCHEMA_WHITESPACE_REPLACE;
     else
         yws = XML_SCHEMA_WHITESPACE_COLLAPSE;
