Merge branch 'master' into channel_list_mutex
[pazpar2-moved-to-github.git] / etc / cf.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3     This stylesheet expects Connector Frameworks records
4 -->
5 <xsl:stylesheet
6     version="1.0"
7     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8     xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
9     xmlns:dc="http://purl.org/dc/elements/1.1/"
10     xmlns:siebel="http://loc.gov/siebel/elements/1.0/" >
11
12  <xsl:output indent="yes"
13         method="xml"
14         version="1.0"
15         encoding="UTF-8"/>
16
17   <xsl:template match="/record">
18     <pz:record>
19       <xsl:apply-templates/>
20     </pz:record>
21   </xsl:template>
22
23   <!--
24       The elements mapped in the following clauses should be kept more
25       or less in sync with those named in builder/templates/search.cft
26       in the "cf" git module.
27   -->
28
29   <xsl:template match="date">
30     <pz:metadata type="publication-date">
31       <xsl:value-of select="."/>
32     </pz:metadata>
33     <pz:metadata type="date">
34       <xsl:value-of select="."/>
35     </pz:metadata>
36   </xsl:template>
37
38   <xsl:template match="url">
39     <pz:metadata type="electronic-url">
40       <xsl:value-of select="."/>
41     </pz:metadata>
42   </xsl:template>
43
44   <xsl:template match="title">
45     <pz:metadata type="title">
46       <xsl:value-of select="."/>
47     </pz:metadata>
48   </xsl:template>
49
50   <xsl:template match="author">
51     <pz:metadata type="author">
52       <xsl:value-of select="."/>
53     </pz:metadata>
54   </xsl:template>
55
56   <xsl:template match="description">
57     <pz:metadata type="description">
58       <xsl:value-of select="."/>
59     </pz:metadata>
60   </xsl:template>
61   
62   <xsl:template match="publisher">
63     <pz:metadata type="publisher">
64       <xsl:value-of select="."/>
65     </pz:metadata>
66   </xsl:template>
67
68   <xsl:template match="subject">
69     <pz:metadata type="subject">
70       <xsl:value-of select="."/>
71     </pz:metadata>
72   </xsl:template>
73
74   <xsl:template match="item">
75     <pz:metadata type="locallocation">
76       <xsl:choose>
77         <xsl:when test="string-length(location)">
78           <xsl:value-of select="location"/>
79         </xsl:when>
80         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
81       </xsl:choose>
82     </pz:metadata>
83     <pz:metadata type="callnumber">
84       <xsl:choose>
85         <xsl:when test="string-length(callno)">
86           <xsl:value-of select="callno"/>
87         </xsl:when>
88         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
89       </xsl:choose>
90     </pz:metadata>
91     <pz:metadata type="available">
92       <xsl:choose>
93         <xsl:when test="string-length(available)">
94           <xsl:value-of select="available"/>
95         </xsl:when>
96         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
97       </xsl:choose>
98     </pz:metadata>
99     <pz:metadata type="publicnote">
100       <xsl:choose>
101         <xsl:when test="string-length(publicnote)">
102           <xsl:value-of select="publicnote"/>
103         </xsl:when>
104         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
105       </xsl:choose>
106     </pz:metadata>
107   </xsl:template>
108
109   <xsl:template match="due">
110     <pz:metadata type="due">
111       <xsl:value-of select="."/>
112     </pz:metadata>
113   </xsl:template>
114
115   <xsl:template match="location">
116     <pz:metadata type="locallocation">
117       <xsl:value-of select="."/>
118     </pz:metadata>
119   </xsl:template>
120
121   <xsl:template match="callno">
122     <pz:metadata type="callnumber">
123       <xsl:value-of select="."/>
124     </pz:metadata>
125   </xsl:template>
126
127   <xsl:template match="thumburl">
128     <pz:metadata type="thumburl">
129       <xsl:value-of select="."/>
130     </pz:metadata>
131   </xsl:template>
132
133   <xsl:template match="score">
134     <pz:metadata type="score">
135       <xsl:value-of select="."/>
136     </pz:metadata>
137   </xsl:template>
138
139   <xsl:template match="text()"/>
140
141 </xsl:stylesheet>