Changes to better support possible outputs of the Connector Framework.
authorMike Taylor <mike@indexdata.com>
Thu, 10 Nov 2011 11:13:08 +0000 (11:13 +0000)
committerMike Taylor <mike@indexdata.com>
Thu, 10 Nov 2011 11:13:08 +0000 (11:13 +0000)
* New, trivial, templates to handle thirteen additional elements:
  available, citation, relevance, booktitle, copyright,
  copyrightabstract, pubtype, doctype, extent, format,
  languageitem, languageabstract and permalink.

* Comment on how the "medium" field is ignored in favour of an XSLT
  parameter.

* Comment on the "holding" element which seems to be a synony, of the
  "item" container.

We now have *a lot* of near-identical tiny templates for handling
individual fields, each mapping the CF's data
<NAME>VALUE</NAME>
to PazPar2's equivalent
<pz:metadata type="NAME">VALUE</pz:metadata>
Should these all be replaced be a single general-puspose rule?  That
would also mean that we'd no longer need to update this stylesheet
each time parseTask.cff changes.

etc/cf.xsl

index ed42c20..49eb5e0 100644 (file)
 
   <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">
     </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="locallocation">
       <xsl:choose>
     </pz:metadata>
   </xsl:template>
 
-  <!-- Fields produced by Connectors but not yet supported here:
-       ### available
-       ### citation
-       ### medium (overlooked in favour of XSLT parameter)
-       ### relevance
-       ### holding (but isn't that a container like "item"?
-       ### booktitle
-       ### copyright
-       ### copyrightabstract
-       ### pubtype
-       ### doctype
-       ### extent
-       ### format
-       ### languageitem
-       ### languageabstract
-       ### permalink
-    -->
+  <xsl:template match="available">
+    <pz:metadata type="available">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="citation">
+    <pz:metadata type="citation">
+      <xsl:value-of select="."/>
+      </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="relevance">
+    <pz:metadata type="relevance">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="booktitle">
+    <pz:metadata type="booktitle">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="copyright">
+    <pz:metadata type="copyright">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="copyrightabstract">
+    <pz:metadata type="copyrightabstract">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="pubtype">
+    <pz:metadata type="pubtype">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="doctype">
+    <pz:metadata type="doctype">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="extent">
+    <pz:metadata type="extent">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="format">
+    <pz:metadata type="format">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="languageitem">
+    <pz:metadata type="languageitem">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="languageabstract">
+    <pz:metadata type="languageabstract">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
+
+  <xsl:template match="permalink">
+    <pz:metadata type="permalink">
+      <xsl:value-of select="."/>
+    </pz:metadata>
+  </xsl:template>
 
   <xsl:template match="text()"/>