XSLT filter uses XML config for to list each supported recordSchema.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 31 May 2005 14:18:17 +0000 (14:18 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 31 May 2005 14:18:17 +0000 (14:18 +0000)
test/xslt/Makefile.am
test/xslt/index.xsl [new file with mode: 0644]
test/xslt/marc1.xsl [deleted file]
test/xslt/marcschema.xml [new file with mode: 0644]
test/xslt/xslt1.c
test/xslt/xslt2.c
test/xslt/xslt3.c

index 69ea9cb..883ebc7 100644 (file)
@@ -1,9 +1,9 @@
-# $Id: Makefile.am,v 1.3 2005-05-01 07:17:47 adam Exp $
+# $Id: Makefile.am,v 1.4 2005-05-31 14:18:17 adam Exp $
 
 check_PROGRAMS = xslt1 xslt2 xslt3
 TESTS = $(check_PROGRAMS)
 
-EXTRA_DIST=zebra.cfg marc-col.xml marc-one.xml marc1.xsl
+EXTRA_DIST=zebra.cfg marc-col.xml marc-one.xml index.xsl id.xsl marcschema.xsl
 
 xslt1_SOURCES = xslt1.c
 xslt2_SOURCES = xslt2.c
diff --git a/test/xslt/index.xsl b/test/xslt/index.xsl
new file mode 100644 (file)
index 0000000..ba168e7
--- /dev/null
@@ -0,0 +1,20 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:m="http://www.loc.gov/MARC21/slim"
+  xmlns:z="http://indexdata.dk/zebra/indexing/1"
+  version="1.0">
+  <!-- $Id: index.xsl,v 1.1 2005-05-31 14:18:17 adam Exp $ -->
+  <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+  
+  <xsl:template match="/m:record/m:controlfield[@tag=001]">
+    <z:index field="control">
+      <xsl:apply-templates match="."/>
+    </z:index>
+  </xsl:template>
+  
+  <xsl:template match="/m:record/m:datafield[@tag=245]">
+    <z:index field="title">
+      <xsl:apply-templates match="."/>
+    </z:index>
+  </xsl:template>
+  
+</xsl:stylesheet>
diff --git a/test/xslt/marc1.xsl b/test/xslt/marc1.xsl
deleted file mode 100644 (file)
index 467fa6a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  xmlns:m="http://www.loc.gov/MARC21/slim"
-  xmlns:z="http://indexdata.dk/zebra/indexing/1"
-  version="1.0">
-  <!-- $Id: marc1.xsl,v 1.2 2005-04-28 13:34:05 adam Exp $ -->
-  <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
-  
-  <xsl:template match="/">
-    <xsl:choose>
-      <xsl:when test="$schema='http://indexdata.dk/zebra/indexing/1'">
-       <xsl:apply-templates mode="index"/>
-      </xsl:when>
-      <xsl:when test="$schema='brief'">
-       <xsl:apply-templates mode="brief"/>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-  
-  <xsl:template match="/m:record/m:controlfield[@tag=001]" mode="index">
-    <z:index field="control">
-      <xsl:apply-templates match="."/>
-    </z:index>
-  </xsl:template>
-  
-  <xsl:template match="/m:record/m:datafield[@tag=245]" mode="index">
-    <z:index field="title">
-      <xsl:apply-templates match="."/>
-    </z:index>
-  </xsl:template>
-  
-  <xsl:template match="/m:record/m:datafield[@tag=245]" mode="brief">
-    <title><xsl:value-of select="."/></title>
-  </xsl:template>
-  
-</xsl:stylesheet>
diff --git a/test/xslt/marcschema.xml b/test/xslt/marcschema.xml
new file mode 100644 (file)
index 0000000..f4cf959
--- /dev/null
@@ -0,0 +1,8 @@
+<schemaInfo>
+  <!-- $Id: marcschema.xml,v 1.1 2005-05-31 14:18:17 adam Exp $ -->
+  <schema name="index" identifier="http://indexdata.dk/zebra/indexing/1"
+          stylesheet="index.xsl" />
+  <schema name="F" stylesheet="id.xsl" />
+</schemaInfo>
+
+   
index df980ef..07788ee 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: xslt1.c,v 1.2 2005-05-01 07:17:47 adam Exp $
+/* $Id: xslt1.c,v 1.3 2005-05-31 14:18:17 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -35,7 +35,7 @@ int main(int argc, char **argv)
 
     zebra_init(zh);
 
-    zebra_set_resource(zh, "recordType", "xslt1.marc1.xsl");
+    zebra_set_resource(zh, "recordType", "xslt1.marcschema.xml");
 
     zebra_begin_trans(zh, 1);
     sprintf(path, "%.200s/marc-col.xml", get_srcdir());
index 8ab9450..fe42211 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: xslt2.c,v 1.2 2005-05-01 07:17:47 adam Exp $
+/* $Id: xslt2.c,v 1.3 2005-05-31 14:18:17 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
     
     zebra_init(zh);
 
-    zebra_set_resource(zh, "recordType", "xslt1.marc1.xsl");
+    zebra_set_resource(zh, "recordType", "xslt1.marcschema.xml");
 
     sprintf(path, "%.200s/marc-col.xml", get_srcdir());
     f = fopen(path, "rb");
index 0fb67c8..0fb1405 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: xslt3.c,v 1.1 2005-05-01 07:17:47 adam Exp $
+/* $Id: xslt3.c,v 1.2 2005-05-31 14:18:17 adam Exp $
    Copyright (C) 1995-2005
    Index Data ApS
 
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
     
     zebra_init(zh);
 
-    zebra_set_resource(zh, "recordType", "xslt.marc1.xsl");
+    zebra_set_resource(zh, "recordType", "xslt.marcschema.xml");
 
     sprintf(path, "%.200s/marc-one.xml", get_srcdir());
     f = fopen(path, "rb");