-// Prepare XSLT stylesheets for record normalization
-static void prepare_map(void *ignore, struct database *db)
-{
- struct setting *s;
-
- if (!db->settings)
- return;
- for (s = db->settings[PZ_XSLT]; s; s = s->next)
- {
- char **stylesheets;
- struct database_retrievalmap **m = &db->map;
- int num, i;
-
- nmem_strsplit(nmem, ",", s->value, &stylesheets, &num);
- for (i = 0; i < num; i++)
- {
- (*m) = nmem_malloc(nmem, sizeof(**m));
- (*m)->next = 0;
- if (!((*m)->stylesheet = conf_load_stylesheet(stylesheets[i])))
- {
- yaz_log(YLOG_FATAL, "Unable to load stylesheet: %s",
- stylesheets[i]);
- exit(1);
- }
- m = &(*m)->next;
- }
- }
- if (!db->map)
- yaz_log(YLOG_WARN, "No Normalization stylesheet for target %s", db->url);
-}
-
-// Read settings for each database, and prepare support data structures
-void prepare_databases(void)
-{
- grep_databases(0, 0, prepare_map);
-}
-
-// This function will most likely vanish when a proper target profile mechanism is
-// introduced.
-void load_simpletargets(const char *fn)
-{
- FILE *f = fopen(fn, "r");
- char line[256];
-
- if (!f)
- {
- yaz_log(YLOG_WARN|YLOG_ERRNO, "open %s", fn);
- exit(1);
- }
-
- while (fgets(line, 255, f))
- {
- char *url;
- char *name;
- struct database *db;
-
- if (strncmp(line, "target ", 7))
- continue;
- line[strlen(line) - 1] = '\0';
-
- if ((name = strchr(line, ';')))
- *(name++) = '\0';
-
- url = line + 7;
-
- if (!(db = find_database(url, 0)))
- yaz_log(YLOG_WARN, "Unable to load database %s", url);
- }
- fclose(f);
-}
-
-