Add mtrace start/stop. Requires MTRACE define
[pazpar2-moved-to-github.git] / test / 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:param name="medium" />
18
19   <xsl:template match="/record">
20     <pz:record>
21       <pz:metadata type="medium">
22          <xsl:value-of select="$medium" />
23       </pz:metadata>
24       <xsl:apply-templates/>
25     </pz:record>
26   </xsl:template>
27
28   <!--
29       The elements mapped in the following clauses should be kept more
30       or less in sync with those named in builder/templates/search.cft
31       in the "cf" git module.
32   -->
33
34   <xsl:template match="date">
35     <pz:metadata type="publication-date">
36       <xsl:value-of select="."/>
37     </pz:metadata>
38     <pz:metadata type="date">
39       <xsl:value-of select="."/>
40     </pz:metadata>
41   </xsl:template>
42
43   <xsl:template match="url">
44     <pz:metadata type="electronic-url">
45       <xsl:value-of select="."/>
46     </pz:metadata>
47   </xsl:template>
48
49   <xsl:template match="title">
50     <pz:metadata type="title">
51       <xsl:value-of select="."/>
52     </pz:metadata>
53     <pz:metadata type="title-complete">
54       <xsl:value-of select="." />
55     </pz:metadata>
56   </xsl:template>
57
58   <xsl:template match="author">
59     <pz:metadata type="author">
60       <xsl:value-of select="."/>
61     </pz:metadata>
62   </xsl:template>
63
64   <xsl:template match="description">
65     <pz:metadata type="description">
66       <xsl:value-of select="."/>
67     </pz:metadata>
68   </xsl:template>
69   
70   <xsl:template match="publisher">
71     <pz:metadata type="publisher">
72       <xsl:value-of select="."/>
73     </pz:metadata>
74   </xsl:template>
75
76   <xsl:template match="subject">
77     <pz:metadata type="subject">
78       <xsl:value-of select="."/>
79     </pz:metadata>
80   </xsl:template>
81
82   <xsl:template match="item">
83     <pz:metadata type="locallocation">
84       <xsl:choose>
85         <xsl:when test="string-length(location)">
86           <xsl:value-of select="location"/>
87         </xsl:when>
88         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
89       </xsl:choose>
90     </pz:metadata>
91     <pz:metadata type="callnumber">
92       <xsl:choose>
93         <xsl:when test="string-length(callno)">
94           <xsl:value-of select="callno"/>
95         </xsl:when>
96         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
97       </xsl:choose>
98     </pz:metadata>
99     <pz:metadata type="available">
100       <xsl:choose>
101         <xsl:when test="string-length(available)">
102           <xsl:value-of select="available"/>
103         </xsl:when>
104         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
105       </xsl:choose>
106     </pz:metadata>
107     <pz:metadata type="publicnote">
108       <xsl:choose>
109         <xsl:when test="string-length(publicnote)">
110           <xsl:value-of select="publicnote"/>
111         </xsl:when>
112         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
113       </xsl:choose>
114     </pz:metadata>
115   </xsl:template>
116
117   <xsl:template match="due">
118     <pz:metadata type="due">
119       <xsl:value-of select="."/>
120     </pz:metadata>
121   </xsl:template>
122
123   <xsl:template match="location">
124     <pz:metadata type="locallocation">
125       <xsl:value-of select="."/>
126     </pz:metadata>
127   </xsl:template>
128
129   <xsl:template match="callno">
130     <pz:metadata type="callnumber">
131       <xsl:value-of select="."/>
132     </pz:metadata>
133   </xsl:template>
134
135   <xsl:template match="thumburl">
136     <pz:metadata type="thumburl">
137       <xsl:value-of select="."/>
138     </pz:metadata>
139   </xsl:template>
140
141   <xsl:template match="score">
142     <pz:metadata type="score">
143       <xsl:value-of select="."/>
144     </pz:metadata>
145   </xsl:template>
146
147   <xsl:template match="text()"/>
148
149 </xsl:stylesheet>