Added check for null values for availability elements
authorSebastian Hammer <quinn@dart.(none)>
Mon, 22 Mar 2010 20:23:04 +0000 (20:23 +0000)
committerSebastian Hammer <quinn@dart.(none)>
Mon, 22 Mar 2010 20:23:04 +0000 (20:23 +0000)
etc/cf.xsl

index 65ad69e..5ee8c67 100644 (file)
     </pz:metadata>
   </xsl:template>
 
-  <xsl:template match="available">
-    <pz:metadata type="available">
-      <xsl:value-of select="."/>
+  <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>
-  </xsl:template>
-
-  <xsl:template match="due">
-    <pz:metadata type="due">
-      <xsl:value-of select="."/>
+    <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>
-  </xsl:template>
-
-  <xsl:template match="location">
-    <pz:metadata type="locallocation">
-      <xsl:value-of select="."/>
+    <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>
   </xsl:template>
 
-  <xsl:template match="callno">
-    <pz:metadata type="callnumber">
+  <xsl:template match="due">
+    <pz:metadata type="due">
       <xsl:value-of select="."/>
     </pz:metadata>
   </xsl:template>