Changes to 'item' data by NE and quinn
[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   </xsl:template>
34
35   <xsl:template match="url">
36     <pz:metadata type="electronic-url">
37       <xsl:value-of select="."/>
38     </pz:metadata>
39   </xsl:template>
40
41   <xsl:template match="title">
42     <pz:metadata type="title">
43       <xsl:value-of select="."/>
44     </pz:metadata>
45   </xsl:template>
46
47   <xsl:template match="author">
48     <pz:metadata type="author">
49       <xsl:value-of select="."/>
50     </pz:metadata>
51   </xsl:template>
52
53   <xsl:template match="description">
54     <pz:metadata type="description">
55       <xsl:value-of select="."/>
56     </pz:metadata>
57   </xsl:template>
58   
59   <xsl:template match="publisher">
60     <pz:metadata type="publisher">
61       <xsl:value-of select="."/>
62     </pz:metadata>
63   </xsl:template>
64
65   <xsl:template match="subject">
66     <pz:metadata type="subject">
67       <xsl:value-of select="."/>
68     </pz:metadata>
69   </xsl:template>
70
71   <xsl:template match="item">
72     <pz:metadata type="locallocation">
73       <xsl:choose>
74         <xsl:when test="string-length(location)">
75           <xsl:value-of select="location"/>
76         </xsl:when>
77         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
78       </xsl:choose>
79     </pz:metadata>
80     <pz:metadata type="callnumber">
81       <xsl:choose>
82         <xsl:when test="string-length(callno)">
83           <xsl:value-of select="callno"/>
84         </xsl:when>
85         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
86       </xsl:choose>
87     </pz:metadata>
88     <pz:metadata type="available">
89       <xsl:choose>
90         <xsl:when test="string-length(available)">
91           <xsl:value-of select="available"/>
92         </xsl:when>
93         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
94       </xsl:choose>
95     </pz:metadata>
96     <pz:metadata type="publicnote">
97       <xsl:choose>
98         <xsl:when test="string-length(publicnote)">
99           <xsl:value-of select="publicnote"/>
100         </xsl:when>
101         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
102       </xsl:choose>
103     </pz:metadata>
104   </xsl:template>
105
106   <xsl:template match="due">
107     <pz:metadata type="due">
108       <xsl:value-of select="."/>
109     </pz:metadata>
110   </xsl:template>
111
112   <xsl:template match="thumburl">
113     <pz:metadata type="thumburl">
114       <xsl:value-of select="."/>
115     </pz:metadata>
116   </xsl:template>
117
118   <xsl:template match="score">
119     <pz:metadata type="score">
120       <xsl:value-of select="."/>
121     </pz:metadata>
122   </xsl:template>
123
124   <xsl:template match="text()"/>
125
126 </xsl:stylesheet>