Move openurl stuff to marc21-ourl.xsl. Hookin marc21.xsl.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 5 May 2009 10:25:15 +0000 (12:25 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 5 May 2009 10:25:15 +0000 (12:25 +0200)
The marc21.xsl now has a template record-hook which allows marc21.xsl to
be imported and record-hook to override stuff. The marc21-ourl.xsl
uses this facility and includes the pz2-ourl-marc21-xsl.

etc/marc21-ourl.xsl [new file with mode: 0644]
etc/marc21.xsl

diff --git a/etc/marc21-ourl.xsl b/etc/marc21-ourl.xsl
new file mode 100644 (file)
index 0000000..804c153
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
+    xmlns:marc="http://www.loc.gov/MARC21/slim">
+
+  
+  <xsl:import href="marc21.xsl" />
+  <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+
+  <xsl:include href="pz2-ourl-marc21.xsl" />
+
+  <xsl:template name="record-hook">
+   Our hook
+      <xsl:if test="$open_url_resolver">
+        <pz:metadata type="open-url">
+            <xsl:call-template name="insert-md-openurl" />
+        </pz:metadata>
+      </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
index d90647f..22710d2 100644 (file)
@@ -4,15 +4,14 @@
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
     xmlns:marc="http://www.loc.gov/MARC21/slim">
-
   
   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
 
 <!-- Extract metadata from MARC21/USMARC 
       http://www.loc.gov/marc/bibliographic/ecbdhome.html
 -->  
-  <xsl:include href="pz2-ourl-marc21.xsl" />
-  
+  <xsl:template name="template-hook"/>
+
   <xsl:template match="/marc:record">
     <xsl:variable name="title_medium" select="marc:datafield[@tag='245']/marc:subfield[@code='h']"/>
     <xsl:variable name="journal_title" select="marc:datafield[@tag='773']/marc:subfield[@code='t']"/>
         </pz:metadata>
       </xsl:for-each>
 
-      <xsl:if test="$open_url_resolver">
-        <pz:metadata type="open-url">
-            <xsl:call-template name="insert-md-openurl" />
-        </pz:metadata>
-      </xsl:if>
+      <!-- passthrough id data -->
+      <xsl:for-each select="pz:metadata">
+          <xsl:copy-of select="."/>
+      </xsl:for-each>
+
+      <!-- other stylesheets importing this might want to define this -->
+      <xsl:call-template name="record-hook"/>
 
     </pz:record>    
   </xsl:template>