Does not inherit from server unless completely empty for chains
[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:param name="medium" />
18
19   <!--
20     According to cf/builder/templates/parseTask.cff, connectors can
21     also generate a "medium" field, but that is ignored in this
22     stylesheet, the rule below instead using an XSLT parameter.
23     Should the data element be used in preference when it is included?
24   -->
25
26   <xsl:template match="/record">
27     <pz:record>
28       <pz:metadata type="medium">
29          <xsl:value-of select="$medium" />
30       </pz:metadata>
31       <xsl:apply-templates/>
32     </pz:record>
33   </xsl:template>
34
35   <!--
36       The elements mapped in the following clauses should be kept more
37       or less in sync with those named in builder/templates/search.cft
38       in the "cf" git module.
39   -->
40
41   <xsl:template match="date">
42     <pz:metadata type="publication-date">
43       <xsl:value-of select="."/>
44     </pz:metadata>
45     <pz:metadata type="date">
46       <xsl:value-of select="."/>
47     </pz:metadata>
48   </xsl:template>
49
50   <xsl:template match="url">
51     <pz:metadata type="electronic-url">
52       <xsl:value-of select="."/>
53     </pz:metadata>
54   </xsl:template>
55
56   <xsl:template match="title">
57     <pz:metadata type="title">
58       <xsl:value-of select="."/>
59     </pz:metadata>
60     <pz:metadata type="title-complete">
61       <xsl:value-of select="." />
62     </pz:metadata>
63   </xsl:template>
64
65   <xsl:template match="journaltitle">
66     <pz:metadata type="journal-title">
67       <xsl:value-of select="."/>
68     </pz:metadata>
69   </xsl:template>
70
71   <!--
72     According to cf/builder/templates/parseTask.cff, connectors can
73     also generate a "holding" field, but it's not clear how that is
74     different from "item".  Perhaps this "item" rule should also
75     handle "holding" in the same way?
76   -->
77
78   <xsl:template match="item">
79     <pz:metadata type="locallocation">
80       <xsl:choose>
81         <xsl:when test="string-length(location)">
82           <xsl:value-of select="location"/>
83         </xsl:when>
84         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
85       </xsl:choose>
86     </pz:metadata>
87     <pz:metadata type="callnumber">
88       <xsl:choose>
89         <xsl:when test="string-length(callno)">
90           <xsl:value-of select="callno"/>
91         </xsl:when>
92         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
93       </xsl:choose>
94     </pz:metadata>
95     <pz:metadata type="available">
96       <xsl:choose>
97         <xsl:when test="string-length(available)">
98           <xsl:value-of select="available"/>
99         </xsl:when>
100         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
101       </xsl:choose>
102     </pz:metadata>
103     <pz:metadata type="publicnote">
104       <xsl:choose>
105         <xsl:when test="string-length(publicnote)">
106           <xsl:value-of select="publicnote"/>
107         </xsl:when>
108         <xsl:otherwise>PAZPAR2_NULL_VALUE</xsl:otherwise>
109       </xsl:choose>
110     </pz:metadata>
111   </xsl:template>
112
113   <xsl:template match="location">
114     <pz:metadata type="locallocation">
115       <xsl:value-of select="."/>
116     </pz:metadata>
117   </xsl:template>
118
119   <xsl:template match="callno">
120     <pz:metadata type="callnumber">
121       <xsl:value-of select="."/>
122     </pz:metadata>
123   </xsl:template>
124
125   <xsl:template match="*" >
126     <pz:metadata type="{local-name()}">
127       <xsl:value-of select="."/>
128     </pz:metadata>
129   </xsl:template>
130
131   <xsl:template match="text()"/>
132
133 </xsl:stylesheet>