- xmlNodePtr root = 0;
- xmlDoc *new;
- if (m->stylesheet)
- {
- new = xsltApplyStylesheet(m->stylesheet, *doc, parms);
- }
- else if (m->marcmap)
- {
- new = marcmap_apply(m->marcmap, *doc);
- }
-
- root = xmlDocGetRootElement(new);
-
- if (!new || !root || !root->children)
- {
- if (new)
- xmlFreeDoc(new);
- xmlFreeDoc(*doc);
- return -1;
- }
- xmlFreeDoc(*doc);
- *doc = new;
+ struct normalize_step *m;
+ for (m = nt->steps; m; m = m->next)
+ {
+ xmlNodePtr root = 0;
+ xmlDoc *ndoc;
+ if (m->stylesheet)
+ ndoc = xsltApplyStylesheet(m->stylesheet, *doc, parms);
+ else if (m->marcmap)
+ ndoc = marcmap_apply(m->marcmap, *doc);
+ else
+ ndoc = 0;
+ xmlFreeDoc(*doc);
+ *doc = 0;
+
+ if (ndoc)
+ root = xmlDocGetRootElement(ndoc);
+
+ if (ndoc && root && root->children)
+ *doc = ndoc;
+ else
+ {
+ if (ndoc)
+ xmlFreeDoc(ndoc);
+ return -1;
+ }
+ }