Update OPAC stylesheets for availabilityDate PAZ-943
[pazpar2-moved-to-github.git] / etc / opac.xsl
index 617a18b..78f3b22 100644 (file)
 
   <xsl:template name="record-hook">
     <xsl:for-each select="/opacRecord/holdings/holding">
-      <pz:metadata type="locallocation">
-        <xsl:choose>
-         <xsl:when test="localLocation">
-           <xsl:value-of select="localLocation"/>
-         </xsl:when>
-         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
-       </xsl:choose>
+      <pz:metadata type="locallocation" empty="PAZPAR2_NULL_VALUE">
+       <xsl:value-of select="localLocation"/>
       </pz:metadata>
-      <pz:metadata type="callnumber">
-        <xsl:choose>
-         <xsl:when test="callNumber">
-           <xsl:value-of select="callNumber"/>
-         </xsl:when>
-         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
-       </xsl:choose>
+      <pz:metadata type="callnumber" empty="PAZPAR2_NULL_VALUE">
+       <xsl:value-of select="callNumber"/>
+      </pz:metadata>
+      <pz:metadata type="publicnote" empty="PAZPAR2_NULL_VALUE">
+       <xsl:value-of select="publicNote"/>
       </pz:metadata>
-      <pz:metadata type="publicnote">
+      <pz:metadata type="available" empty="PAZPAR2_NULL_VALUE">
         <xsl:choose>
-         <xsl:when test="publicNote">
-           <xsl:value-of select="publicNote"/>
+          <xsl:when test="circulations/circulation/availableNow/@value = '1'">
+             Available
+          </xsl:when>
+          <xsl:when test="circulations/circulation/availableNow/@value = '0'">
+           <xsl:value-of select="circulations/circulation/availabilityDate"/>
          </xsl:when>
-         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
-       </xsl:choose>
+        </xsl:choose>
       </pz:metadata>
     </xsl:for-each>
   </xsl:template>
 
   <xsl:template match="/">
-    <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
+    <xsl:choose>
+      <xsl:when test="opacRecord">
+        <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
 
 </xsl:stylesheet>