Ensure medium is also applied if Solr record do not have it PAZ-929
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 7 Apr 2014 18:12:00 +0000 (20:12 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 7 Apr 2014 18:12:00 +0000 (20:12 +0200)
etc/solr-pz2.xsl

index 4fe7bc1..f6fa5dd 100644 (file)
 
   <xsl:template match="doc">
     <pz:record>
+      <xsl:if test="string-length($medium) &gt; 0">
+        <pz:metadata type="medium">
+           <xsl:value-of select="$medium"/>
+        </pz:metadata>
+      </xsl:if>
       <xsl:apply-templates></xsl:apply-templates>
     </pz:record>
   </xsl:template>
@@ -61,8 +66,7 @@
          <xsl:value-of select="../@name"/>
        </xsl:attribute>
        <xsl:choose>
-         <xsl:when test="../@name = 'medium' and string-length($medium) > 0">
-           <xsl:value-of select="$medium"/>
+         <xsl:when test="../@name = 'medium' and string-length($medium) = 0">
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="."/>