Pazpar2 1.4.4-2 for squeeze
[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">
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="publicnote">
35         <xsl:choose>
36           <xsl:when test="publicNote">
37             <xsl:value-of select="publicNote"/>
38           </xsl:when>
39           <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
40         </xsl:choose>
41       </pz:metadata>
42       <pz:metadata type="available">
43         <xsl:choose>
44           <xsl:when test="circulations/circulation/availableNow/@value = '1'">
45              Available
46           </xsl:when>
47           <xsl:when test="circulations/circulation/availableNow/@value = '0'">
48              <xsl:choose>
49                <xsl:when test="circulations/circulation/availabiltyDate">
50                  <xsl:value-of select="circulations/circulation/availabiltyDate"/>
51                </xsl:when>
52                <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
53              </xsl:choose>
54           </xsl:when>
55           <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
56         </xsl:choose>
57       </pz:metadata>
58     </xsl:for-each>
59   </xsl:template>
60   <xsl:template match="/">
61     <xsl:choose>
62       <xsl:when test="opacRecord">
63         <xsl:apply-templates select="opacRecord/bibliographicRecord"/>
64       </xsl:when>
65       <xsl:otherwise>
66         <xsl:apply-templates/>
67       </xsl:otherwise>
68     </xsl:choose>
69   </xsl:template>
70
71 </xsl:stylesheet>