Bump copyright year
[idzebra-moved-to-github.git] / test / xslt / dom1.c
index d68ec7a..be4fe80 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the Zebra server.
-   Copyright (C) 1995-2008 Index Data
+   Copyright (C) 2004-2013 Index Data
 
 Zebra 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
@@ -17,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 */
 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 #include <yaz/test.h>
 #include "testlib.h"
 
@@ -26,7 +29,7 @@ void index_more(ZebraHandle zh, const char *filter, const char *file)
     char path[256];
     char profile_path[256];
 
-    sprintf(profile_path, "%.80s:%.80s/../../tab", 
+    sprintf(profile_path, "%.80s:%.80s/../../tab",
             tl_get_srcdir(), tl_get_srcdir());
     zebra_set_resource(zh, "profilePath", profile_path);
 
@@ -58,14 +61,14 @@ ZebraHandle index_some(ZebraService zs,
 void tst(int argc, char **argv)
 {
     ZebraHandle zh;
-    
+
     ZebraService zs = tl_start_up(0, argc, argv);
 
     zh = index_some(zs, "dom.bad.xml", "marc-col.xml");
     zebra_close(zh);
 
-   
-    /* testing XMLREADER input with PI stylesheet */ 
+
+    /* testing XMLREADER input with PI stylesheet */
     zh = index_some(zs, "dom.dom-config-col.xml", "marc-col.xml");
     YAZ_CHECK(tl_query(zh, "@attr 1=title computer", 3));
 
@@ -80,22 +83,21 @@ void tst(int argc, char **argv)
                      zh, "snippet", yaz_oid_recsyn_xml,
                      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                      "<root>\n"
-                     "  <z:meta xmlns:z=\"http://indexdata.com/zebra-2.0\" element_set_name=\"snippet\">"
-                     "<record xmlns=\"http://www.indexdata.com/zebra/\">\n"
+                     "  <record xmlns=\"http://www.indexdata.com/zebra/\">\n"
                      "  <snippet name=\"title\" type=\"w\">How to program a <s>computer</s></snippet>\n"
-                     "</record></z:meta>\n"
+                     "</record>\n"
                      "  <title>How to program a computer</title>\n"
                      "</root>\n"),
                  ZEBRA_OK);
 
     YAZ_CHECK(tl_query(zh, "@attr 1=control 11224466", 1));
-    
+
     YAZ_CHECK(tl_query_x(zh, "@attr 1=titl computer", 0, 114));
     YAZ_CHECK(tl_query_x(zh, "@attr 1=4 computer", 0, 121));
     zebra_close(zh);
 
 
-    /* testing XMLREADER input with ELEMENT stylesheet */ 
+    /* testing XMLREADER input with ELEMENT stylesheet */
     zh = index_some(zs, "dom.dom-config-one.xml", "marc-one.xml");
     YAZ_CHECK(tl_query(zh, "@attr 1=title computer", 1));
     YAZ_CHECK(tl_query(zh, "@attr 1=control 11224466", 1));
@@ -103,7 +105,7 @@ void tst(int argc, char **argv)
     YAZ_CHECK(tl_query_x(zh, "@attr 1=4 computer", 0, 121));
     zebra_close(zh);
 
-    /* testing MARC input with ELEMENT stylesheet */ 
+    /* testing MARC input with ELEMENT stylesheet */
     zh = index_some(zs, "dom.dom-config-marc.xml", "marc-col.mrc");
     YAZ_CHECK(tl_query(zh, "@attr 1=title computer", 3));
     YAZ_CHECK(tl_query(zh, "@attr 1=control 11224466", 1));
@@ -111,14 +113,14 @@ void tst(int argc, char **argv)
     YAZ_CHECK(tl_query_x(zh, "@attr 1=4 computer", 0, 121));
     zebra_close(zh);
 
-    /* testing XMLREADER input with ELEMENT stylesheet and skipped records */ 
+    /* testing XMLREADER input with ELEMENT stylesheet and skipped records */
     zh = index_some(zs, "dom.dom-config-skipped.xml", "marc-col.xml");
     YAZ_CHECK(tl_query(zh, "@attr 1=title computer", 1));
     YAZ_CHECK(tl_query(zh, "@attr 1=control 11224466", 0));
     YAZ_CHECK(tl_query(zh, "@attr 1=control 11224467", 1));
     YAZ_CHECK(tl_query(zh, "@attr 1=control 73090924", 0));
 
-    /* testing XMLREADER input with type attributes (insert,delete,..) */ 
+    /* testing XMLREADER input with type attributes (insert,delete,..) */
     zh = index_some(zs, "dom.dom-config-del.xml", "del-col.xml");
     YAZ_CHECK(tl_query(zh, "@attr 1=title a", 1));
     YAZ_CHECK(tl_query(zh, "@attr 1=title 1", 0));
@@ -127,14 +129,17 @@ void tst(int argc, char **argv)
     YAZ_CHECK(tl_query(zh, "@attr 1=title b", 1));
 
     zh = index_some(zs, "dom.gutenberg.xml", "gutenberg-sample.xml");
-    YAZ_CHECK(tl_query(zh, "selected", 1));
+    YAZ_CHECK(tl_query(zh, "oscar", 1));
 
     YAZ_CHECK_EQ(tl_fetch_first_compare(
                      zh, "zebra::snippet", yaz_oid_recsyn_xml,
                      "<record xmlns=\"http://www.indexdata.com/zebra/\">\n"
-                     "  <snippet name=\"any\" type=\"w\">etext/1338\n"
-                     "    Project Gutenberg\n"
-                     "    <s>Selected</s> Prose of Oscar Wilde</snippet>\n"
+                     "  <snippet name=\"any\" type=\"w\" fields=\"title\">"
+                     "Selected Prose of <s>Oscar</s> Wilde"
+                     "</snippet>\n"
+                     "  <snippet name=\"any\" type=\"w\" fields=\"creator\">"
+                     "Wilde, <s>Oscar</s>, 1854-1900"
+                     "</snippet>\n"
                      "</record>"),
                  ZEBRA_OK);
 
@@ -149,6 +154,7 @@ TL_MAIN
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab