Adds 'available' to holdings information
[pazpar2-moved-to-github.git] / etc / opac.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet
3     version="1.0"
4     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5     xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
6     xmlns:marc="http://www.loc.gov/MARC21/slim">
7   
8   <xsl:import href="marc21.xsl"/>
9
10   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
11
12 <!-- Extract metadata from OPAC records with embedded MAR records
13       http://www.loc.gov/marc/bibliographic/ecbdhome.html
14 -->  
15
16   <xsl:template name="record-hook">
17     <xsl:for-each select="/opacRecord/holdings/holding">
18       <pz:metadata type="locallocation">
19         <xsl:choose>
20           <xsl:when test="localLocation">
21             <xsl:value-of select="localLocation"/>
22           </xsl:when>
23           <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
24         </xsl:choose>
25       </pz:metadata>
26       <pz:metadata type="callnumber">
27         <xsl:choose>
28           <xsl:when test="callNumber">
29             <xsl:value-of select="callNumber"/>
30           </xsl:when>
31           <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
32         </xsl:choose>
33       </pz:metadata>
34       <pz:metadata type="available">
35         <xsl:choose>
36           <xsl:when test="string-length(available)">
37             <xsl:value-of select="available"/>
38           </xsl:when>
39           <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
40         </xsl:choose>
41       </pz:metadata>
42       <pz:metadata type="publicnote">
43         <xsl:choose>
44           <xsl:when test="publicNote">
45             <xsl:value-of select="publicNote"/>
46           </xsl:when>
47           <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
48         </xsl:choose>
49       </pz:metadata>
50     </xsl:for-each>
51   </xsl:template>
52
53   <xsl:template match="/">
54     <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
55   </xsl:template>
56
57 </xsl:stylesheet>