add template match 'medium' to cf stylesheet
[pazpar2-moved-to-github.git] / etc / cf.xsl
index 5ee8c67..1c05886 100644 (file)
         version="1.0"
         encoding="UTF-8"/>
 
+  <xsl:param name="medium" />
+
+  <!--
+    According to cf/builder/templates/parseTask.cff, connectors can
+    also generate a "medium" field, but that is ignored in this
+    stylesheet, the rule below instead using an XSLT parameter.
+    Should the data element be used in preference when it is included?
+  -->
+
   <xsl:template match="/record">
     <pz:record>
+      <pz:metadata type="medium">
+         <xsl:value-of select="$medium" />
+      </pz:metadata>
       <xsl:apply-templates/>
     </pz:record>
   </xsl:template>
@@ -30,6 +42,9 @@
     <pz:metadata type="publication-date">
       <xsl:value-of select="."/>
     </pz:metadata>
+    <pz:metadata type="date">
+      <xsl:value-of select="."/>
+    </pz:metadata>
   </xsl:template>
 
   <xsl:template match="url">
     <pz:metadata type="title">
       <xsl:value-of select="."/>
     </pz:metadata>
-  </xsl:template>
-
-  <xsl:template match="author">
-    <pz:metadata type="author">
-      <xsl:value-of select="."/>
+    <pz:metadata type="title-complete">
+      <xsl:value-of select="." />
     </pz:metadata>
   </xsl:template>
 
-  <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:template match="journaltitle">
+    <pz:metadata type="journal-title">
       <xsl:value-of select="."/>
     </pz:metadata>
   </xsl:template>
 
-  <xsl:template match="subject">
-    <pz:metadata type="subject">
-      <xsl:value-of select="."/>
-    </pz:metadata>
-  </xsl:template>
+  <!--
+    According to cf/builder/templates/parseTask.cff, connectors can
+    also generate a "holding" field, but it's not clear how that is
+    different from "item".  Perhaps this "item" rule should also
+    handle "holding" in the same way?
+  -->
 
   <xsl:template match="item">
-    <pz:metadata type="location">
-      <xsl:choose>
-       <xsl:when test="location">
-         <xsl:value-of select="location"/>
-       </xsl:when>
-       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
-      </xsl:choose>
+    <pz:metadata type="due" empty="PAZPAR2_NULL_VALUE">
+      <xsl:value-of select="due"/>
+    </pz:metadata>
+    <pz:metadata type="locallocation" empty="PAZPAR2_NULL_VALUE">
+      <xsl:value-of select="location"/>
+    </pz:metadata>
+    <pz:metadata type="callnumber" empty="PAZPAR2_NULL_VALUE">
+      <xsl:value-of select="callno"/>
     </pz:metadata>
-    <pz:metadata type="callno">
-      <xsl:choose>
-       <xsl:when test="callno">
-         <xsl:value-of select="callno"/>
-       </xsl:when>
-       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
-      </xsl:choose>
+    <pz:metadata type="available" empty="PAZPAR_NULL_VALUE">
+      <xsl:value-of select="available"/>
     </pz:metadata>
-    <pz:metadata type="avaliable">
-      <xsl:choose>
-       <xsl:when test="available">
-         <xsl:value-of select="available"/>
-       </xsl:when>
-       <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
-      </xsl:choose>
+    <pz:metadata type="publicnote" empty="PAZPAR2_NULL_VALUE">
+      <xsl:value-of select="publicnote"/>
     </pz:metadata>
   </xsl:template>
 
-  <xsl:template match="due">
-    <pz:metadata type="due">
+  <xsl:template match="location">
+    <pz:metadata type="locallocation">
       <xsl:value-of select="."/>
     </pz:metadata>
   </xsl:template>
 
-  <xsl:template match="thumburl">
-    <pz:metadata type="thumburl">
+  <xsl:template match="callno">
+    <pz:metadata type="callnumber">
       <xsl:value-of select="."/>
     </pz:metadata>
   </xsl:template>
 
-  <xsl:template match="score">
-    <pz:metadata type="score">
+  <xsl:template match="medium">
+  </xsl:template>
+
+  <xsl:template match="*" >
+    <pz:metadata type="{local-name()}">
       <xsl:value-of select="."/>
     </pz:metadata>
   </xsl:template>