add template match 'medium' to cf stylesheet
[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="due" empty="PAZPAR2_NULL_VALUE">
80       <xsl:value-of select="due"/>
81     </pz:metadata>
82     <pz:metadata type="locallocation" empty="PAZPAR2_NULL_VALUE">
83       <xsl:value-of select="location"/>
84     </pz:metadata>
85     <pz:metadata type="callnumber" empty="PAZPAR2_NULL_VALUE">
86       <xsl:value-of select="callno"/>
87     </pz:metadata>
88     <pz:metadata type="available" empty="PAZPAR_NULL_VALUE">
89       <xsl:value-of select="available"/>
90     </pz:metadata>
91     <pz:metadata type="publicnote" empty="PAZPAR2_NULL_VALUE">
92       <xsl:value-of select="publicnote"/>
93     </pz:metadata>
94   </xsl:template>
95
96   <xsl:template match="location">
97     <pz:metadata type="locallocation">
98       <xsl:value-of select="."/>
99     </pz:metadata>
100   </xsl:template>
101
102   <xsl:template match="callno">
103     <pz:metadata type="callnumber">
104       <xsl:value-of select="."/>
105     </pz:metadata>
106   </xsl:template>
107
108   <xsl:template match="medium">
109   </xsl:template>
110
111   <xsl:template match="*" >
112     <pz:metadata type="{local-name()}">
113       <xsl:value-of select="."/>
114     </pz:metadata>
115   </xsl:template>
116
117   <xsl:template match="text()"/>
118
119 </xsl:stylesheet>