Remove abs path
[pazpar2-moved-to-github.git] / src / pazpar2_config.c
index 4762aa5..62e57f8 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Pazpar2.
-   Copyright (C) 2006-2009 Index Data
+   Copyright (C) 2006-2010 Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -26,9 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
-#include <libxslt/xslt.h>
-#include <libxslt/transform.h>
-#include <libxslt/xsltutils.h>
 
 #include <yaz/yaz-util.h>
 #include <yaz/nmem.h>
@@ -412,9 +409,19 @@ static int parse_metadata(struct conf_service *service, xmlNode *n,
     else
         sortkey_offset = -1;
     
-    if (xml_mergekey && strcmp((const char *) xml_mergekey, "no"))
+    if (xml_mergekey)
     {
-        mergekey_type = Metadata_mergekey_yes;
+        if (!strcmp((const char *) xml_mergekey, "required"))
+            mergekey_type = Metadata_mergekey_required;
+        else if (!strcmp((const char *) xml_mergekey, "optional"))
+            mergekey_type = Metadata_mergekey_optional;
+        else if (!strcmp((const char *) xml_mergekey, "no"))
+            mergekey_type = Metadata_mergekey_no;
+        else
+        {
+            yaz_log(YLOG_FATAL, "Unknown value for mergekey: %s", xml_mergekey);
+            return -1;
+        }
     }
     
     
@@ -433,6 +440,7 @@ static int parse_metadata(struct conf_service *service, xmlNode *n,
     xmlFree(xml_termlist);
     xmlFree(xml_rank);
     xmlFree(xml_setting);
+    xmlFree(xml_mergekey);
     (*md_node)++;
     return 0;
 }
@@ -787,8 +795,7 @@ static struct conf_server *server_create(struct conf_config *config,
                 }
                 else if (!(*sp)->id && !service_id)
                 {
-                    yaz_log(YLOG_FATAL, "Duplicate unnamed service '%s'",
-                        service_id);
+                    yaz_log(YLOG_FATAL, "Duplicate unnamed service");
                     break;
                 }
 
@@ -822,17 +829,13 @@ static struct conf_server *server_create(struct conf_config *config,
     return server;
 }
 
-xsltStylesheet *conf_load_stylesheet(struct conf_service *service,
-                                     const char *fname)
+WRBUF conf_get_fname(struct conf_service *service, const char *fname)
 {
     struct conf_config *config = service->server->config;
     WRBUF w = wrbuf_alloc();
-    xsltStylesheet *s;
 
     conf_dir_path(config, w, fname);
-    s = xsltParseStylesheetFile((xmlChar *) wrbuf_cstr(w));
-    wrbuf_destroy(w);
-    return s;
+    return w;
 }
 
 static struct conf_targetprofiles *parse_targetprofiles(NMEM nmem,
@@ -1067,7 +1070,11 @@ struct conf_config *config_create(const char *fname, int verbose)
         {
             yaz_log(YLOG_LOG, "Configuration %s after include processing",
                     fname);
+#if LIBXML_VERSION >= 20600
             xmlDocFormatDump(yaz_log_file(), doc, 0);
+#else
+            xmlDocDump(yaz_log_file(), doc);
+#endif
         }
         r = parse_config(config, n);
     }