Adds 'medium' as an optional parameter to style sheet
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 22 Sep 2010 13:49:20 +0000 (06:49 -0700)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 22 Sep 2010 13:49:20 +0000 (06:49 -0700)
.. to support override of the per-title medium type with a
   per-target medium type

etc/tmarc.xsl

index 0dc7b20..795b4d0 100644 (file)
@@ -5,6 +5,7 @@
 
   <xsl:output indent="yes" method="xml" version="1.0"
     encoding="UTF-8" />
+  <xsl:param name="medium"/>
 
   <!-- Extract metadata from MARC21/USMARC from streamlined marcxml format 
     http://www.loc.gov/marc/bibliographic/ecbdhome.html -->
       </xsl:choose>
     </xsl:variable>
 
-    <xsl:variable name="medium">
+    <xsl:variable name="vmedium">
       <xsl:choose>
-       <xsl:when test="($typeofrec='a' or $typeofrec='t') and $biblevel='m'">book</xsl:when>
+        <xsl:when test="string-length($medium)"><xsl:value-of select="$medium" /></xsl:when>
+        <xsl:when test="($typeofrec='a' or $typeofrec='t') and $biblevel='m'">book</xsl:when>
         <xsl:when test="$typeofrec='j' or $typeofrec='i'">
          <xsl:text>recording</xsl:text>
          <xsl:choose>
       </xsl:for-each>
 
       <pz:metadata type="medium">
-        <xsl:value-of select="$medium" />
-       <xsl:if test="string-length($electronic) and $medium != 'electronic'">
+        <xsl:value-of select="$vmedium" />
+       <xsl:if test="string-length($electronic) and $vmedium != 'electronic'">
          <xsl:text> (electronic)</xsl:text>
        </xsl:if>
       </pz:metadata>