- if (global_parameters.dump_records){
- fprintf(stderr,
- "Input Record (normalized) from %s\n----------------\n",
- db->url);
-#if LIBXML_VERSION >= 20600
- xmlDocFormatDump(stderr, rdoc, 1);
-#else
- xmlDocDump(stderr, rdoc);
-#endif
- }
-
- for (m = sdb->map; m; m = m->next){
- xmlDoc *new = 0;
-
-#if 1
- {
- xmlNodePtr root = 0;
- new = xsltApplyStylesheet(m->stylesheet, rdoc, 0);
- root= xmlDocGetRootElement(new);
- if (!new || !root || !(root->children))
- {
- yaz_log(YLOG_WARN, "XSLT transformation failed from %s",
- sdb->database->url);
- xmlFreeDoc(new);
- xmlFreeDoc(rdoc);
- return 0;
- }
- }
-#else
- // do it another way to detect transformation errors right now
- // but does not seem to work either!
- {
- xsltTransformContextPtr ctxt;
- ctxt = xsltNewTransformContext(m->stylesheet, rdoc);
- new = xsltApplyStylesheetUser(m->stylesheet, rdoc, 0, 0, 0, ctxt);
- if ((ctxt->state == XSLT_STATE_ERROR) ||
- (ctxt->state == XSLT_STATE_STOPPED)){
- yaz_log(YLOG_WARN, "XSLT transformation failed from %s",
- cl->database->database->url);
- xmlFreeDoc(new);
- xmlFreeDoc(rdoc);
- return 0;
- }
- }
-#endif
-
- xmlFreeDoc(rdoc);
- rdoc = new;
- }