aded record indexing rule - now need to do all seperate indexes
authorMarc Cromme <marc@indexdata.dk>
Thu, 8 Jun 2006 10:53:28 +0000 (10:53 +0000)
committerMarc Cromme <marc@indexdata.dk>
Thu, 8 Jun 2006 10:53:28 +0000 (10:53 +0000)
examples/marcxml/MARC21slim2INDEX.xsl

index 9a421d5..145a6a7 100644 (file)
@@ -1,29 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
-                xmlns:z="http://indexdata.dk/zebra/xslt/1" 
-                xmlns:a="http://alvis.info/enriched/" 
-                xmlns:m="http://www.loc.gov/MARC21/slim"
-                version="1.0">
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+    xmlns:z="http://indexdata.dk/zebra/xslt/1" 
+    xmlns:marc="http://www.loc.gov/MARC21/slim" 
+    version="1.0">
 
 
+  <xsl:include href="http://www.loc.gov/marcxml/xslt/MARC21slimUtils.xsl"/>
   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
-  <!-- <xsl:include href="xpath.xsl"/> -->
-  
 
   <!-- disable all default text node output -->
   <xsl:template match="text()"/>
 
 
   <!-- disable all default text node output -->
   <xsl:template match="text()"/>
 
+  <xsl:template match="/">
+    <xsl:if test="marc:collection">
+      <collection>
+        <xsl:apply-templates select="marc:record"/>
+      </collection>
+    </xsl:if>
+    <xsl:if test="marc:record">
+       <xsl:apply-templates select="marc:record"/>
+    </xsl:if>
+  </xsl:template>
+
 
   <!-- match on marcxml record -->
 
   <!-- match on marcxml record -->
-  <xsl:template match="//m:record">
-    <z:record>
+  <xsl:template match="marc:record">
+    <xsl:variable name="controlField001" select="marc:controlfield[@tag=001]"/>
+    <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>
+    <z:record id="{$controlField001}" type="update">
       <!-- <xsl:attribute name="id"></xsl:attribute> -->
       <!-- <xsl:attribute name="id"></xsl:attribute> -->
-      <xsl:attribute name="type">update</xsl:attribute>
+      <!-- <xsl:attribute name="type">update</xsl:attribute> -->
       <!-- <xsl:attribute name="rank"></xsl:attribute> -->
       <!-- <xsl:attribute name="rank"></xsl:attribute> -->
-
-      RECORD
-
     </z:record>
   </xsl:template>
     </z:record>
   </xsl:template>
-
-
 </xsl:stylesheet>
 </xsl:stylesheet>