+#if HAVE_XSLT
+int Yaz_ProxyConfig::check_schema(xmlNodePtr ptr, Z_RecordComposition *comp,
+ const char *schema_identifier)
+{
+ char *esn = 0;
+ int default_match = 1;
+ if (comp && comp->which == Z_RecordComp_simple &&
+ comp->u.simple && comp->u.simple->which == Z_ElementSetNames_generic)
+ {
+ esn = comp->u.simple->u.generic;
+ }
+ // if no ESN/schema was given accept..
+ if (!esn)
+ return 1;
+ // check if schema identifier match
+ if (schema_identifier && !strcmp(esn, schema_identifier))
+ return 1;
+ // Check each name element
+ for (; ptr; ptr = ptr->next)
+ {
+ if (ptr->type == XML_ELEMENT_NODE
+ && !strcmp((const char *) ptr->name, "name"))
+ {
+ xmlNodePtr tptr = ptr->children;
+ default_match = 0;
+ for (; tptr; tptr = tptr->next)
+ if (tptr->type == XML_TEXT_NODE && tptr->content)
+ {
+ xmlChar *t = tptr->content;
+ while (*t && isspace(*t))
+ t++;
+ int i = 0;
+ while (esn[i] && esn[i] == t[i])
+ i++;
+ if (!esn[i] && (!t[i] || isspace(t[i])))
+ return 1;
+ }
+ }
+ }
+ return default_match;
+}
+#endif
+