Update OPAC stylesheets for availabilityDate PAZ-943
[pazpar2-moved-to-github.git] / etc / opac_turbomarc.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.indexdata.com/turbomarc">
7   
8   <xsl:import href="tmarc.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" empty="PAZPAR2_NULL_VALUE">
19         <xsl:value-of select="localLocation"/>
20       </pz:metadata>
21       <pz:metadata type="callnumber" empty="PAZPAR2_NULL_VALUE">
22         <xsl:value-of select="callNumber"/>
23       </pz:metadata>
24       <pz:metadata type="publicnote" empty="PAZPAR2_NULL_VALUE">
25         <xsl:value-of select="publicNote"/>
26       </pz:metadata>
27       <pz:metadata type="available" empty="PAZPAR2_NULL_VALUE">
28         <xsl:choose>
29           <xsl:when test="circulations/circulation/availableNow/@value = '1'">
30              Available
31           </xsl:when>
32           <xsl:when test="circulations/circulation/availableNow/@value = '0'">
33             <xsl:value-of select="circulations/circulation/availabilityDate"/>
34           </xsl:when>
35         </xsl:choose>
36       </pz:metadata>
37     </xsl:for-each>
38   </xsl:template>
39   <xsl:template match="/">
40     <xsl:choose>
41       <xsl:when test="opacRecord">
42         <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
43       </xsl:when>
44       <xsl:otherwise>
45         <xsl:apply-templates/>
46       </xsl:otherwise>
47     </xsl:choose>
48   </xsl:template>
49
50 </xsl:stylesheet>