Changed naming convention for embedded records for DOM filter.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 9 Jul 2008 09:39:52 +0000 (11:39 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 9 Jul 2008 09:39:52 +0000 (11:39 +0200)
The retrieve section uses process-meta rather than meta and the
attribute for meta is called name rather than element_set_name.

NEWS
index/mod_dom.c
test/xslt/dcaddmeta.xsl
test/xslt/dom-config-col.xml
test/xslt/dom-snippet.xsl
test/xslt/dom1.c
test/xslt/gutenberg.xml

diff --git a/NEWS b/NEWS
index fa04a36..8718e24 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,13 +1,13 @@
 Added a facility to embed metadata for records generated by the DOM XML
-filter. The meta data step is triggered by a 'meta' section in the
+filter. The meta data step is triggered by a 'process-meta' section in the
 retrieve section of the dom config, e.g.
   <retrieve name="myelementset">
     <xslt stylesheet="my-usual.xsl"/>
-    <meta/>
+    <process-meta/>
   </retrieve>
 The meta section substitutes metadata for all elements called 'meta' in
 namespace http://indexdata.com/zebra-2.0 . The meta element must have
-exactly one attribute, element_set_name, which specifies the special
+exactly one attribute, name, which specifies the special
 element set name which is equivalent to the suffix to zebra:: for
 non-embedded special retrievals. This allows snippets, facets etc to be
 included.
index 4393ded..95c8a06 100644 (file)
@@ -338,7 +338,7 @@ static ZEBRA_RES parse_convert(struct filter_info *tinfo, xmlNodePtr ptr,
             *l = p;
             l = &p->next;
         }
-        else if (!XML_STRCMP(ptr->name, "meta"))
+        else if (!XML_STRCMP(ptr->name, "process-meta"))
         {
             struct _xmlAttr *attr;
             struct convert_s *p = nmem_malloc(tinfo->nmem_config, sizeof(*p));
@@ -376,13 +376,12 @@ static int process_meta(struct filter_info *tinfo, xmlDocPtr doc, xmlNodePtr nod
             struct _xmlAttr *attr;      
             for (attr = node->properties; attr; attr = attr->next)
             {
-                if (attr_content(attr, "element_set_name", &element_set_name))
+                if (attr_content(attr, "name", &element_set_name))
                     ;
                 else
                 {
                     dom_log(YLOG_WARN, tinfo, node,
-                            "bad attribute @%s, expected @element_set_name",
-                            attr->name);
+                            "bad attribute @%s, expected @name", attr->name);
                 }
             }
             if (element_set_name)
index c41a2f6..4edd20a 100644 (file)
@@ -10,7 +10,7 @@
               xmlns:dc="http://purl.org/dc/elements/1.1/"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <xsl:copy-of select="*"/>
-      <z:meta element_set_name="snippet"/>
+      <z:meta name="snippet"/>
     </srw_dc:dc>
   </xsl:template>
 
index 7b66def..d19cefe 100644 (file)
@@ -10,7 +10,7 @@
   </retrieve>
   <retrieve name="snippet">
     <xslt stylesheet="dom-snippet.xsl"/>
-    <meta/>
+    <process-meta/>
   </retrieve>
   <input syntax="xml">
     <xmlreader level="1"/>
index 6178eed..a817fbf 100644 (file)
@@ -9,7 +9,7 @@
 
   <xsl:template match="/">
     <root>
-    <z:meta element_set_name="snippet"/>
+    <z:meta name="snippet"/>
     <xsl:apply-templates/>
     </root>
   </xsl:template>
index d68ec7a..10c4834 100644 (file)
@@ -80,7 +80,7 @@ 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\">"
+                     "  <z:meta xmlns:z=\"http://indexdata.com/zebra-2.0\" name=\"snippet\">"
                      "<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"
index b2a8b4f..65736f5 100644 (file)
@@ -12,7 +12,7 @@
 
   <retrieve name="dcsnippets">
     <xslt stylesheet="dcaddmeta.xsl"/>
-    <meta/>
+    <process-meta/>
   </retrieve>
 
   <retrieve name="index">