Removed md-electronic from tmarc.xsl -- changed to suffix to 'medium'.
[pazpar2-moved-to-github.git] / etc / cf.xsl
index 78f264c..ac8d0dd 100644 (file)
@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-
     This stylesheet expects Connector Frameworks records
-    $Id: usco.xsl,v 1.3 2009-01-13 15:18:42 wosch Exp $
-
 -->
 <xsl:stylesheet
     version="1.0"
 
   <xsl:template match="/record">
     <pz:record>
+      <xsl:apply-templates/>
+    </pz:record>
+  </xsl:template>
 
-      <xsl:attribute name="mergekey">
-       <xsl:text>title </xsl:text>
-        <xsl:value-of select="title" />
-       <xsl:text> author </xsl:text>
-        <xsl:value-of select="author"/>
-      </xsl:attribute>
+  <!--
+      The elements mapped in the following clauses should be kept more
+      or less in sync with those named in builder/templates/search.cft
+      in the "cf" git module.
+  -->
 
-      <pz:metadata type="id">
-        <xsl:value-of select="url"/>
-      </pz:metadata>
+  <xsl:template match="date">
+    <pz:metadata type="publication-date">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+    <pz:metadata type="date">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
 
-      <pz:metadata type="author">
-        <xsl:value-of select="author"/>
-      </pz:metadata>
+  <xsl:template match="url">
+    <pz:metadata type="electronic-url">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
 
-        <pz:metadata type="title">
-          <xsl:value-of select="title" />
-        </pz:metadata>
+  <xsl:template match="title">
+    <pz:metadata type="title">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
 
-        <pz:metadata type="date">
-          <xsl:value-of select="date" />
-        </pz:metadata>
+  <xsl:template match="author">
+    <pz:metadata type="author">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
 
-        <pz:metadata type="electronic-url">
-          <xsl:value-of select="url" />
-        </pz:metadata>
+  <xsl:template match="description">
+    <pz:metadata type="description">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+  
+  <xsl:template match="publisher">
+    <pz:metadata type="publisher">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
 
-    </pz:record>
+  <xsl:template match="subject">
+    <pz:metadata type="subject">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="item">
+    <pz:metadata type="locallocation">
+      <xsl:choose>
+       <xsl:when test="string-length(location)">
+         <xsl:value-of select="location"/>
+       </xsl:when>
+       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
+      </xsl:choose>
+    </pz:metadata>
+    <pz:metadata type="callnumber">
+      <xsl:choose>
+       <xsl:when test="string-length(callno)">
+         <xsl:value-of select="callno"/>
+       </xsl:when>
+       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
+      </xsl:choose>
+    </pz:metadata>
+    <pz:metadata type="available">
+      <xsl:choose>
+       <xsl:when test="string-length(available)">
+         <xsl:value-of select="available"/>
+       </xsl:when>
+       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
+      </xsl:choose>
+    </pz:metadata>
+    <pz:metadata type="publicnote">
+      <xsl:choose>
+       <xsl:when test="string-length(publicnote)">
+         <xsl:value-of select="publicnote"/>
+       </xsl:when>
+       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
+      </xsl:choose>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="due">
+    <pz:metadata type="due">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="location">
+    <pz:metadata type="locallocation">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="callno">
+    <pz:metadata type="callnumber">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="thumburl">
+    <pz:metadata type="thumburl">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="score">
+    <pz:metadata type="score">
+      <xsl:value-of select="."/>
+    </pz:metadata>
   </xsl:template>
 
   <xsl:template match="text()"/>