Bug 15503 [QA Followup] - Remove the use of GetBranchesLoop
[koha.git] / etc / pazpar2 / marc21-work-groups.xsl
blob62515730f4ece58b45a85cb5af3782d0e64c59d7
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Id: marc21.xsl,v 1.22 2007-10-04 12:01:15 adam Exp $ -->
3 <xsl:stylesheet
4 version="1.0"
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:pz="http://www.indexdata.com/pazpar2/1.0"
7 xmlns:marc="http://www.loc.gov/MARC21/slim">
10 <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
12 <!-- Extract metadata from MARC21/USMARC
13 http://www.loc.gov/marc/bibliographic/ecbdhome.html
14 -->
15 <xsl:include href="MARC21slimUtils.xsl" />
16 <xsl:include href="pz2-ourl-marc21.xsl" />
18 <xsl:template match="/marc:record">
19 <xsl:variable name="title_medium" select="marc:datafield[@tag='245']/marc:subfield[@code='h']"/>
20 <xsl:variable name="journal_title" select="marc:datafield[@tag='773']/marc:subfield[@code='t']"/>
21 <xsl:variable name="electronic_location_url" select="marc:datafield[@tag='856']/marc:subfield[@code='u']"/>
22 <xsl:variable name="medium">
23 <xsl:choose>
24 <xsl:when test="$title_medium">
25 <xsl:value-of select="substring-after(substring-before($title_medium,']'),'[')"/>
26 </xsl:when>
27 <xsl:when test="$electronic_location_url">
28 <xsl:text>electronic resource</xsl:text>
29 </xsl:when>
30 <xsl:when test="$journal_title">
31 <xsl:text>article</xsl:text>
32 </xsl:when>
33 <xsl:otherwise>
34 <xsl:text>book</xsl:text>
35 </xsl:otherwise>
36 </xsl:choose>
37 </xsl:variable>
39 <xsl:variable name="uniform_title_key">
40 <xsl:choose>
41 <xsl:when test="marc:datafield[@tag='130']">
42 <xsl:for-each select="marc:datafield[@tag='130']">
43 <xsl:call-template name="subfieldSelect">
44 <xsl:with-param name="codes">adgknmpr</xsl:with-param>
45 </xsl:call-template>
46 </xsl:for-each>
47 </xsl:when>
48 <xsl:when test="marc:datafield[@tag='240']">
49 <xsl:for-each select="marc:datafield[@tag='240']">
50 <xsl:call-template name="subfieldSelect">
51 <xsl:with-param name="codes">adgknmpr</xsl:with-param>
52 </xsl:call-template>
53 </xsl:for-each>
54 </xsl:when>
55 <xsl:when test="marc:datafield[@tag='243']">
56 <xsl:for-each select="marc:datafield[@tag='243']">
57 <xsl:call-template name="subfieldSelect">
58 <xsl:with-param name="codes">adgknmpr</xsl:with-param>
59 </xsl:call-template>
60 </xsl:for-each>
61 </xsl:when>
62 </xsl:choose>
63 </xsl:variable>
65 <xsl:variable name="title_key">
66 <xsl:for-each select="marc:datafield[@tag='245']">
67 <xsl:call-template name="subfieldSelect">
68 <xsl:with-param name="codes">abnp</xsl:with-param>
69 </xsl:call-template>
70 </xsl:for-each>
71 </xsl:variable>
73 <xsl:variable name="work_title">
74 <xsl:choose>
75 <xsl:when test="$uniform_title_key != ''">
76 <xsl:value-of select="$uniform_title_key" />
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:value-of select="$title_key" />
80 </xsl:otherwise>
81 </xsl:choose>
82 </xsl:variable>
84 <xsl:variable name="non_ut_main_entry_key">
85 <xsl:choose>
86 <xsl:when test="marc:datafield[@tag='100']">
87 <xsl:for-each select="marc:datafield[@tag='100']">
88 <xsl:call-template name="subfieldSelect">
89 <xsl:with-param name="codes">abcd</xsl:with-param>
90 </xsl:call-template>
91 </xsl:for-each>
92 </xsl:when>
93 <xsl:when test="marc:datafield[@tag='110']">
94 <xsl:for-each select="marc:datafield[@tag='110']">
95 <xsl:call-template name="subfieldSelect">
96 <xsl:with-param name="codes">abcd</xsl:with-param>
97 </xsl:call-template>
98 </xsl:for-each>
99 </xsl:when>
100 <xsl:when test="marc:datafield[@tag='111']">
101 <xsl:for-each select="marc:datafield[@tag='111']">
102 <xsl:call-template name="subfieldSelect">
103 <xsl:with-param name="codes">abcdnq</xsl:with-param>
104 </xsl:call-template>
105 </xsl:for-each>
106 </xsl:when>
107 </xsl:choose>
108 </xsl:variable>
110 <xsl:variable name="mergekey">
111 <xsl:text>titlekey </xsl:text>
112 <xsl:value-of select="$work_title" />
113 <xsl:if test="$non_ut_main_entry_key != ''">
114 <xsl:text> namemainentry </xsl:text>
115 <xsl:value-of select="$non_ut_main_entry_key" />
116 </xsl:if>
117 </xsl:variable>
119 <pz:record>
120 <xsl:attribute name="mergekey">
121 <xsl:value-of select="$mergekey"/>
122 </xsl:attribute>
124 <xsl:for-each select="marc:datafield[@tag='999']">
125 <pz:metadata type="kohaid">
126 <xsl:value-of select="marc:subfield[@code='c']"/>
127 </pz:metadata>
128 </xsl:for-each>
130 <!--
131 <xsl:for-each select="marc:datafield[@tag='020']">
132 <pz:metadata type="isbn">
133 <xsl:value-of select="marc:subfield[@code='a']"/>
134 </pz:metadata>
135 </xsl:for-each>
138 <xsl:for-each select="marc:datafield[@tag='245']">
139 <pz:metadata type="work-title">
140 <xsl:value-of select="$work_title" />
141 </pz:metadata>
142 </xsl:for-each>
144 <xsl:if test="$non_ut_main_entry_key != ''">
145 <pz:metadata type="work-author">
146 <xsl:value-of select="$non_ut_main_entry_key" />
147 </pz:metadata>
148 </xsl:if>
149 <!--
150 <xsl:for-each select="marc:datafield[@tag='250']">
151 <pz:metadata type="edition">
152 <xsl:value-of select="marc:subfield[@code='a']"/>
153 </pz:metadata>
154 </xsl:for-each>
156 <xsl:for-each select="marc:datafield[@tag='260']">
157 <pz:metadata type="publication-place">
158 <xsl:value-of select="marc:subfield[@code='a']"/>
159 </pz:metadata>
160 <pz:metadata type="publication-name">
161 <xsl:value-of select="marc:subfield[@code='b']"/>
162 </pz:metadata>
163 <pz:metadata type="publication-date">
164 <xsl:value-of select="marc:subfield[@code='c']"/>
165 </pz:metadata>
166 </xsl:for-each>
169 <!--
170 <xsl:for-each select="marc:datafield[@tag='300']">
171 <pz:metadata type="physical-extent">
172 <xsl:value-of select="marc:subfield[@code='a']"/>
173 </pz:metadata>
174 <pz:metadata type="physical-format">
175 <xsl:value-of select="marc:subfield[@code='b']"/>
176 </pz:metadata>
177 <pz:metadata type="physical-dimensions">
178 <xsl:value-of select="marc:subfield[@code='c']"/>
179 </pz:metadata>
180 <pz:metadata type="physical-accomp">
181 <xsl:value-of select="marc:subfield[@code='e']"/>
182 </pz:metadata>
183 <pz:metadata type="physical-unittype">
184 <xsl:value-of select="marc:subfield[@code='f']"/>
185 </pz:metadata>
186 <pz:metadata type="physical-unitsize">
187 <xsl:value-of select="marc:subfield[@code='g']"/>
188 </pz:metadata>
189 <pz:metadata type="physical-specified">
190 <xsl:value-of select="marc:subfield[@code='3']"/>
191 </pz:metadata>
192 </xsl:for-each>
195 </pz:record>
197 </xsl:template>
199 </xsl:stylesheet>