SRW, CQL, 2003
[yaz-moved-to-github.git] / etc / MARC21slim2MODS.xsl
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <xsl:stylesheet version="1.0" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns="http://www.loc.gov/mods/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">\r
3         <xsl:include href="MARC21slimUtils.xsl"/>\r
4         <xsl:output method="xml" indent="yes"/>\r
5         \r
6         <xsl:template match="/">\r
7                 <collection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/  http://www.loc.gov/standards/marcxml/schema/mods.xsd">\r
8                         <xsl:apply-templates/>\r
9                 </collection>\r
10         </xsl:template>\r
11 \r
12         <xsl:template match="marc:record">\r
13                 <mods>\r
14                         <xsl:variable name="leader" select="marc:leader"/>\r
15                         <xsl:variable name="leader6" select="substring($leader,7,1)"/>\r
16                         <xsl:variable name="leader7" select="substring($leader,8,1)"/>\r
17                         <xsl:variable name="controlField008" select="marc:controlfield[@tag=008]"/>\r
18 \r
19                         <xsl:variable name="typeOf008">\r
20                                 <xsl:choose>\r
21                                         <xsl:when test="$leader6='a'">\r
22                                                 <xsl:choose>\r
23                                                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>\r
24                                                         <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>                             \r
25                                                 </xsl:choose>\r
26                                         </xsl:when>\r
27                                         <xsl:when test="$leader6='t'">BK</xsl:when>\r
28                                         <xsl:when test="$leader6='p'">MM</xsl:when>\r
29                                         <xsl:when test="$leader6='m'">CF</xsl:when>     \r
30                                         <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>     \r
31                                         <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>                             \r
32                                         <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'">MU</xsl:when>                             \r
33                                 </xsl:choose>\r
34                         </xsl:variable>\r
35 \r
36                         <xsl:for-each select="marc:datafield[@tag=245]">\r
37                                 <titleInfo>\r
38                                         <xsl:variable name="title">\r
39                                                 <xsl:call-template name="chopPunctuation">\r
40                                                         <xsl:with-param name="chopString">\r
41                                                                 <xsl:call-template name="subfieldSelect">\r
42                                                                         <xsl:with-param name="codes">abfghk</xsl:with-param>\r
43                                                                 </xsl:call-template>\r
44                                                         </xsl:with-param>\r
45                                                 </xsl:call-template>\r
46                                         </xsl:variable>\r
47                                         <xsl:choose>\r
48                                                 <xsl:when test="@ind2>0">\r
49                                                         <nonSort>\r
50                                                                 <xsl:value-of select="substring($title,1,@ind2)"/>\r
51                                                         </nonSort>\r
52                                                         <title>\r
53                                                                 <xsl:value-of select="substring($title,@ind2+1)"/>\r
54                                                         </title>\r
55                                                 </xsl:when>\r
56                                                 <xsl:otherwise>\r
57                                                         <title>\r
58                                                                 <xsl:value-of select="$title"/>\r
59                                                         </title>\r
60                                                 </xsl:otherwise>\r
61                                         </xsl:choose>\r
62                                         <xsl:call-template name="part"/>\r
63                                 </titleInfo>\r
64                         </xsl:for-each>\r
65                         \r
66                         <xsl:for-each select="marc:datafield[@tag=210]">\r
67                                 <titleInfo type="abbreviated">\r
68                                         <title>\r
69                                                 <xsl:call-template name="subfieldSelect">\r
70                                                         <xsl:with-param name="codes">ab</xsl:with-param>\r
71                                                 </xsl:call-template>\r
72                                         </title>\r
73                                 </titleInfo>\r
74                         </xsl:for-each>\r
75                         \r
76                         <xsl:for-each select="marc:datafield[@tag=242]">\r
77                                 <titleInfo type="translated">\r
78                                         <title>\r
79                                                 <xsl:call-template name="subfieldSelect">\r
80                                                         <xsl:with-param name="codes">abh</xsl:with-param>\r
81                                                 </xsl:call-template>\r
82                                         </title>\r
83                                         <xsl:call-template name="part"/>\r
84                                 </titleInfo>\r
85                         </xsl:for-each>\r
86                         \r
87                         <xsl:for-each select="marc:datafield[@tag=246]">\r
88                                 <titleInfo type="alternative">\r
89                                         <xsl:for-each select="marc:subfield[@code='i']">\r
90                                                 <xsl:attribute name="displayLabel">\r
91                                                         <xsl:value-of select="text()"/>\r
92                                                 </xsl:attribute>\r
93                                         </xsl:for-each>\r
94                                         <title>\r
95                                                 <xsl:call-template name="subfieldSelect">\r
96                                                         <xsl:with-param name="codes">abfh</xsl:with-param>\r
97                                                 </xsl:call-template>\r
98                                         </title>\r
99                                         <xsl:call-template name="part"/>                        \r
100                                 </titleInfo>\r
101                         </xsl:for-each>\r
102 \r
103                         <xsl:for-each select="marc:datafield[@tag=130]|marc:datafield[@tag=240]|marc:datafield[@tag=730][@ind2!=2]">\r
104                                 <titleInfo type="uniform">\r
105                                         <title>\r
106                                                 <xsl:variable name="str">\r
107                                                         <xsl:for-each select="marc:subfield">\r
108                                                                 <xsl:if test="(contains('adfhklmor',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">\r
109                                                                         <xsl:value-of select="text()"/><xsl:text> </xsl:text>\r
110                                                                 </xsl:if>\r
111                                                         </xsl:for-each>\r
112                                                 </xsl:variable>\r
113                                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>\r
114                                         </title>\r
115                                         <xsl:call-template name="part"/>                        \r
116                                 </titleInfo>\r
117                         </xsl:for-each>\r
118 \r
119                         <xsl:for-each select="marc:datafield[@tag=740][@ind2!=2]">\r
120                                 <titleInfo type="alternative">\r
121                                         <title>\r
122                                                 <xsl:call-template name="subfieldSelect">\r
123                                                         <xsl:with-param name="codes">ah</xsl:with-param>\r
124                                                 </xsl:call-template>\r
125                                         </title>\r
126                                         <xsl:call-template name="part"/>                        \r
127                                 </titleInfo>\r
128                         </xsl:for-each>\r
129                         \r
130                         <xsl:for-each select="marc:datafield[@tag=100]">\r
131                                 <name type="personal">\r
132                                         <xsl:call-template name="nameABCDQ"/>\r
133                                         <xsl:call-template name="affiliation"/>\r
134                                         <role>creator</role>\r
135                                         <xsl:call-template name="role"/>\r
136                                 </name>\r
137                         </xsl:for-each>\r
138 \r
139 \r
140                         <xsl:for-each select="marc:datafield[@tag=110]">\r
141                                 <name type="corporate">\r
142                                         <xsl:call-template name="nameABCDN"/>\r
143                                         <role>creator</role>\r
144                                         <xsl:call-template name="role"/>\r
145                                 </name>\r
146                         </xsl:for-each>\r
147 \r
148                         <xsl:for-each select="marc:datafield[@tag=111]">\r
149                                 <name type="conference">\r
150                                         <xsl:call-template name="nameACDEQ"/>\r
151                                         <role>creator</role>\r
152                                         <xsl:for-each select="marc:subfield[@code='4']">\r
153                                                 <role><xsl:value-of select="."/></role>\r
154                                         </xsl:for-each>\r
155                                 </name>\r
156                         </xsl:for-each>\r
157 \r
158                         <xsl:for-each select="marc:datafield[@tag=700][not(marc:subfield[@code='t'])]">\r
159                                 <name type="personal">\r
160                                         <xsl:call-template name="nameABCDQ"/>\r
161                                         <xsl:call-template name="affiliation"/>\r
162                                         <xsl:call-template name="role"/>\r
163                                 </name>\r
164                         </xsl:for-each>\r
165 \r
166                         <xsl:for-each select="marc:datafield[@tag=710][not(marc:subfield[@code='t'])]">\r
167                                 <name type="corporate">\r
168                                         <xsl:call-template name="nameABCDN"/>\r
169                                         <xsl:call-template name="role"/>\r
170                                 </name>\r
171                         </xsl:for-each>\r
172 \r
173                         <xsl:for-each select="marc:datafield[@tag=711][not(marc:subfield[@code='t'])]">\r
174                                 <name type="conference">\r
175                                         <xsl:call-template name="nameACDEQ"/>\r
176                                         <xsl:for-each select="marc:subfield[@code='4']">\r
177                                                 <role><xsl:value-of select="."/></role>\r
178                                         </xsl:for-each>\r
179                                 </name>\r
180                         </xsl:for-each>\r
181 \r
182                         <xsl:for-each select="marc:datafield[@tag=720][not(marc:subfield[@code='t'])]">\r
183                                 <name>\r
184                                         <xsl:if test="@ind1=1">\r
185                                                 <xsl:attribute name="type">personal</xsl:attribute>\r
186                                         </xsl:if>\r
187                                         <namePart>\r
188                                                 <xsl:value-of select="marc:subfield[@code='a']"/>\r
189                                         </namePart>\r
190                                         <xsl:call-template name="role"/>\r
191                                 </name>\r
192                         </xsl:for-each>\r
193 \r
194                         <typeOfResource>                \r
195                                 <xsl:if test="$leader7='c'">\r
196                                         <xsl:attribute name="collection">yes</xsl:attribute>\r
197                                 </xsl:if>\r
198                                 <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">\r
199                                         <xsl:attribute name="manuscript">yes</xsl:attribute>\r
200                                 </xsl:if>\r
201 \r
202                                 <xsl:choose>\r
203                                         <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>\r
204                                         <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>\r
205                                         <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>\r
206                                         <xsl:when test="$leader6='i' or $leader6='j'">sound recording</xsl:when>\r
207                                         <xsl:when test="$leader6='k'">still image</xsl:when>\r
208                                         <xsl:when test="$leader6='g'">moving image</xsl:when>\r
209                                         <xsl:when test="$leader6='r'">three dimensional object</xsl:when>\r
210                                         <xsl:when test="$leader6='m'">software, multimedia</xsl:when>\r
211                                         <xsl:when test="$leader6='p'">mixed material</xsl:when>\r
212                                 </xsl:choose>\r
213                         </typeOfResource>\r
214 \r
215                                 <xsl:if test="substring($controlField008,26,1)='d'">\r
216                                         <genre authority="marc">globe</genre>\r
217                                 </xsl:if>\r
218                         \r
219                                 <xsl:if test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">\r
220                                         <genre authority="marc">remote sensing image</genre>\r
221                                 </xsl:if>\r
222 \r
223                                 <xsl:if test="$typeOf008='MP'">\r
224                                         <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>\r
225                                         <xsl:choose>\r
226                                                 <xsl:when test="$controlField008-25='a' or $controlField008-25='b' or $controlField008-25='c' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">\r
227                                                         <genre authority="marc">map</genre>\r
228                                                 </xsl:when>\r
229                                                 <xsl:when test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">\r
230                                                         <genre authority="marc">atlas</genre>\r
231                                                 </xsl:when>\r
232                                         </xsl:choose>\r
233                                 </xsl:if>\r
234 \r
235                                 <xsl:if test="$typeOf008='SE'">\r
236                                         <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>\r
237                                         <xsl:choose>\r
238                                                 <xsl:when test="$controlField008-21='d'">\r
239                                                         <genre authority="marc">database</genre>\r
240                                                 </xsl:when>\r
241                                                 <xsl:when test="$controlField008-21='l'">       \r
242                                                         <genre authority="marc">loose-leaf</genre>\r
243                                                 </xsl:when>\r
244                                                 <xsl:when test="$controlField008-21='m'">\r
245                                                         <genre authority="marc">series</genre>\r
246                                                 </xsl:when>\r
247                                                 <xsl:when test="$controlField008-21='n'">\r
248                                                         <genre authority="marc">newspaper</genre>       \r
249                                                 </xsl:when>\r
250                                                 <xsl:when test="$controlField008-21='p'">\r
251                                                         <genre authority="marc">periodical</genre>\r
252                                                 </xsl:when>\r
253                                                 <xsl:when test="$controlField008-21='w'">\r
254                                                         <genre authority="marc">web site</genre>\r
255                                                 </xsl:when>\r
256                                         </xsl:choose>\r
257                                 </xsl:if>\r
258 \r
259                                 <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">\r
260                                         <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>\r
261                                         <xsl:choose>\r
262                                                 <xsl:when test="contains($controlField008-24,'a')">\r
263                                                         <genre authority="marc">abstract or summary</genre>\r
264                                                 </xsl:when>\r
265                                                 <xsl:when test="contains($controlField008-24,'b')">\r
266                                                         <genre authority="marc">bibliography</genre>\r
267                                                 </xsl:when>\r
268                                                 <xsl:when test="contains($controlField008-24,'c')">\r
269                                                         <genre authority="marc">catalog</genre>\r
270                                                 </xsl:when>\r
271                                                 <xsl:when test="contains($controlField008-24,'d')">\r
272                                                         <genre authority="marc">dictionary</genre>\r
273                                                 </xsl:when>\r
274                                                 <xsl:when test="contains($controlField008-24,'e')">\r
275                                                         <genre authority="marc">encyclopedia</genre>\r
276                                                 </xsl:when>\r
277                                                 <xsl:when test="contains($controlField008-24,'f')">\r
278                                                         <genre authority="marc">handbook</genre>\r
279                                                 </xsl:when>\r
280                                                 <xsl:when test="contains($controlField008-24,'g')">\r
281                                                         <genre authority="marc">legal article</genre>\r
282                                                 </xsl:when>\r
283                                                 <xsl:when test="contains($controlField008-24,'i')">\r
284                                                         <genre authority="marc">index</genre>\r
285                                                 </xsl:when>\r
286                                                 <xsl:when test="contains($controlField008-24,'k')">\r
287                                                         <genre authority="marc">discography</genre>\r
288                                                 </xsl:when>\r
289                                                 <xsl:when test="contains($controlField008-24,'l')">\r
290                                                         <genre authority="marc">legislation</genre>\r
291                                                 </xsl:when>\r
292                                                 <xsl:when test="contains($controlField008-24,'m')">\r
293                                                         <genre authority="marc">theses</genre>\r
294                                                 </xsl:when>\r
295                                                 <xsl:when test="contains($controlField008-24,'n')">\r
296                                                         <genre authority="marc">survey of literature</genre>\r
297                                                 </xsl:when>\r
298                                                 <xsl:when test="contains($controlField008-24,'o')">\r
299                                                         <genre authority="marc">review</genre>\r
300                                                 </xsl:when>\r
301                                                 <xsl:when test="contains($controlField008-24,'p')">\r
302                                                         <genre authority="marc">programmed text</genre>\r
303                                                 </xsl:when>                                     \r
304                                                 <xsl:when test="contains($controlField008-24,'q')">\r
305                                                         <genre authority="marc">filmography</genre>\r
306                                                 </xsl:when>\r
307                                                 <xsl:when test="contains($controlField008-24,'r')">\r
308                                                         <genre authority="marc">directory</genre>\r
309                                                 </xsl:when>\r
310                                                 <xsl:when test="contains($controlField008-24,'s')">\r
311                                                         <genre authority="marc">statistics</genre>\r
312                                                 </xsl:when>\r
313                                                 <xsl:when test="contains($controlField008-24,'t')">\r
314                                                         <genre authority="marc">technical report</genre>\r
315                                                 </xsl:when>\r
316                                                 <xsl:when test="contains($controlField008-24,'v')">\r
317                                                         <genre authority="marc">legal case and case notes</genre>\r
318                                                 </xsl:when>\r
319                                                 <xsl:when test="contains($controlField008-24,'w')">\r
320                                                         <genre authority="marc">law report or digest</genre>\r
321                                                 </xsl:when>\r
322                                                 <xsl:when test="contains($controlField008-24,'z')">\r
323                                                         <genre authority="marc">treaty</genre>\r
324                                                 </xsl:when>      \r
325                                         </xsl:choose>\r
326                                         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>\r
327                                         <xsl:choose>\r
328                                                 <xsl:when test="$controlField008-29='1'">\r
329                                                         <genre authority="marc">conference publication</genre>\r
330                                                 </xsl:when>\r
331                                         </xsl:choose>\r
332                                 </xsl:if>\r
333 \r
334                                 <xsl:if test="$typeOf008='CF'">\r
335                                         <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>\r
336                                         <xsl:choose>\r
337                                                 <xsl:when test="$controlField008-26='a'">\r
338                                                         <genre authority="marc">numeric data</genre>\r
339                                                 </xsl:when>\r
340                                                 <xsl:when test="$controlField008-26='e'">\r
341                                                         <genre authority="marc">database</genre>\r
342                                                 </xsl:when>\r
343                                                 <xsl:when test="$controlField008-26='f'">\r
344                                                         <genre authority="marc">font</genre>\r
345                                                 </xsl:when>\r
346                                                 <xsl:when test="$controlField008-26='g'">\r
347                                                         <genre authority="marc">game</genre>\r
348                                                 </xsl:when>\r
349                                         </xsl:choose>\r
350                                 </xsl:if>\r
351 \r
352                                 <xsl:if test="$typeOf008='BK'">\r
353                                         <xsl:if test="substring($controlField008,25,1)='j'">\r
354                                                 <genre authority="marc">patent</genre>\r
355                                         </xsl:if>\r
356                                         <xsl:if test="substring($controlField008,31,1)='1'">\r
357                                                 <genre authority="marc">festschrift</genre>\r
358                                         </xsl:if>\r
359 \r
360                                         <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>\r
361                                         <xsl:if test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">\r
362                                                 <genre authority="marc">biography</genre>\r
363                                         </xsl:if>\r
364 \r
365                                         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>\r
366                                         <xsl:choose>\r
367                                                 <xsl:when test="$controlField008-33='e'">\r
368                                                         <genre authority="marc">essay</genre>\r
369                                                 </xsl:when>\r
370                                                 <xsl:when test="$controlField008-33='d'">\r
371                                                         <genre authority="marc">drama</genre>\r
372                                                 </xsl:when>\r
373                                                 <xsl:when test="$controlField008-33='c'">\r
374                                                         <genre authority="marc">comic strip</genre>\r
375                                                 </xsl:when>\r
376                                                 <xsl:when test="$controlField008-33='l'">\r
377                                                         <genre authority="marc">fiction</genre>\r
378                                                 </xsl:when>\r
379                                                 <xsl:when test="$controlField008-33='h'">\r
380                                                         <genre authority="marc">humor, satire</genre>\r
381                                                 </xsl:when>\r
382                                                 <xsl:when test="$controlField008-33='i'">\r
383                                                         <genre authority="marc">letter</genre>\r
384                                                 </xsl:when>\r
385                                                 <xsl:when test="$controlField008-33='f'">\r
386                                                         <genre authority="marc">novel</genre>\r
387                                                 </xsl:when>\r
388                                                 <xsl:when test="$controlField008-33='j'">\r
389                                                         <genre authority="marc">short story</genre>\r
390                                                 </xsl:when>\r
391                                                 <xsl:when test="$controlField008-33='s'">\r
392                                                         <genre authority="marc">speech</genre>\r
393                                                 </xsl:when>\r
394                                         </xsl:choose>\r
395                                 </xsl:if>\r
396 \r
397                                 <xsl:if test="$typeOf008='MU'">\r
398                                         <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>\r
399                                         <xsl:if test="contains($controlField008-30-31,'b')">\r
400                                                 <genre authority="marc">biography</genre>\r
401                                         </xsl:if>\r
402                                         <xsl:if test="contains($controlField008-30-31,'c')">\r
403                                                 <genre authority="marc">conference publication</genre>\r
404                                         </xsl:if>\r
405                                         <xsl:if test="contains($controlField008-30-31,'d')">\r
406                                                 <genre authority="marc">drama</genre>\r
407                                         </xsl:if>\r
408                                         <xsl:if test="contains($controlField008-30-31,'e')">\r
409                                                 <genre authority="marc">essay</genre>\r
410                                         </xsl:if>\r
411                                         <xsl:if test="contains($controlField008-30-31,'f')">\r
412                                                 <genre authority="marc">fiction</genre>\r
413                                         </xsl:if>\r
414                                         <xsl:if test="contains($controlField008-30-31,'o')">\r
415                                                 <genre authority="marc">folktale</genre>\r
416                                         </xsl:if>\r
417                                         <xsl:if test="contains($controlField008-30-31,'h')">\r
418                                                 <genre authority="marc">history</genre>\r
419                                         </xsl:if>\r
420                                         <xsl:if test="contains($controlField008-30-31,'k')">\r
421                                                 <genre authority="marc">humor, satire</genre>\r
422                                         </xsl:if>\r
423                                         <xsl:if test="contains($controlField008-30-31,'m')">\r
424                                                 <genre authority="marc">memoir</genre>\r
425                                         </xsl:if>\r
426                                         <xsl:if test="contains($controlField008-30-31,'p')">\r
427                                                 <genre authority="marc">poetry</genre>\r
428                                         </xsl:if>\r
429                                         <xsl:if test="contains($controlField008-30-31,'r')">\r
430                                                 <genre authority="marc">rehersal</genre>\r
431                                         </xsl:if>\r
432                                         <xsl:if test="contains($controlField008-30-31,'g')">\r
433                                                 <genre authority="marc">reporting</genre>\r
434                                         </xsl:if>\r
435                                         <xsl:if test="contains($controlField008-30-31,'s')">\r
436                                                 <genre authority="marc">sound</genre>\r
437                                         </xsl:if>\r
438                                         <xsl:if test="contains($controlField008-30-31,'l')">\r
439                                                 <genre authority="marc">speech</genre>\r
440                                         </xsl:if>\r
441                                 </xsl:if>\r
442 \r
443                                 <xsl:if test="$typeOf008='VM'">\r
444                                         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>\r
445                                         <xsl:choose>\r
446                                                 <xsl:when test="$controlField008-33='a'">\r
447                                                         <genre authority="marc">art original</genre>\r
448                                                 </xsl:when>\r
449                                                 <xsl:when test="$controlField008-33='b'">\r
450                                                         <genre authority="marc">kit</genre>\r
451                                                 </xsl:when>\r
452                                                 <xsl:when test="$controlField008-33='c'">\r
453                                                         <genre authority="marc">art reproduction</genre>\r
454                                                 </xsl:when>\r
455                                                 <xsl:when test="$controlField008-33='d'">\r
456                                                         <genre authority="marc">diorama</genre>\r
457                                                 </xsl:when>\r
458                                                 <xsl:when test="$controlField008-33='f'">\r
459                                                         <genre authority="marc">filmstrip</genre>\r
460                                                 </xsl:when>\r
461                                                 <xsl:when test="$controlField008-33='g'">\r
462                                                         <genre authority="marc">legal article</genre>\r
463                                                 </xsl:when>\r
464                                                 <xsl:when test="$controlField008-33='i'">\r
465                                                         <genre authority="marc">picture</genre>\r
466                                                 </xsl:when>\r
467                                                 <xsl:when test="$controlField008-33='k'">\r
468                                                         <genre authority="marc">graphic</genre>\r
469                                                 </xsl:when>\r
470                                                 <xsl:when test="$controlField008-33='l'">\r
471                                                         <genre authority="marc">technical drawing</genre>\r
472                                                 </xsl:when>\r
473                                                 <xsl:when test="$controlField008-33='m'">\r
474                                                         <genre authority="marc">motion picture</genre>\r
475                                                 </xsl:when>\r
476                                                 <xsl:when test="$controlField008-33='n'">\r
477                                                         <genre authority="marc">chart</genre>\r
478                                                 </xsl:when>\r
479                                                 <xsl:when test="$controlField008-33='o'">\r
480                                                         <genre authority="marc">flash card</genre>\r
481                                                 </xsl:when>\r
482                                                 <xsl:when test="$controlField008-33='p'">\r
483                                                         <genre authority="marc">microscope slide</genre>\r
484                                                 </xsl:when>                                     \r
485                                                 <xsl:when test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">\r
486                                                         <genre authority="marc">model</genre>\r
487                                                 </xsl:when>\r
488                                                 <xsl:when test="$controlField008-33='r'">\r
489                                                         <genre authority="marc">realia</genre>\r
490                                                 </xsl:when>\r
491                                                 <xsl:when test="$controlField008-33='s'">\r
492                                                         <genre authority="marc">slide</genre>\r
493                                                 </xsl:when>\r
494                                                 <xsl:when test="$controlField008-33='t'">\r
495                                                         <genre authority="marc">transparency</genre>\r
496                                                 </xsl:when>\r
497                                                 <xsl:when test="$controlField008-33='v'">\r
498                                                         <genre authority="marc">videorecording</genre>\r
499                                                 </xsl:when>\r
500                                                 <xsl:when test="$controlField008-33='w'">\r
501                                                         <genre authority="marc">toy</genre>\r
502                                                 </xsl:when> \r
503                                         </xsl:choose>\r
504                                 </xsl:if>\r
505 \r
506                                 <xsl:for-each select="marc:datafield[@tag=655]">\r
507                                         <genre authority="marc">\r
508                                                 <xsl:attribute name="authority">\r
509                                                         <xsl:value-of select="marc:subfield[@code='2']"/>\r
510                                                 </xsl:attribute>\r
511                                                 <xsl:call-template name="subfieldSelect">\r
512                                                         <xsl:with-param name="codes">abvxyz</xsl:with-param>\r
513                                                         <xsl:with-param name="delimeter">-</xsl:with-param>\r
514                                                 </xsl:call-template>\r
515                                         </genre>\r
516                                 </xsl:for-each>\r
517 \r
518                         <publicationInfo>\r
519                                 <xsl:variable name="MARCpublicationCode" select="normalize-space(substring($controlField008,16,3))"/>\r
520                                 \r
521                                 <xsl:if test="translate($MARCpublicationCode,'|','')">\r
522                                         <placeCode authority="marc">\r
523                                                 <xsl:value-of select="$MARCpublicationCode"/>\r
524                                         </placeCode>\r
525                                 </xsl:if>\r
526                         \r
527                                 <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">\r
528                                         <placeCode authority="iso3166">\r
529                                                 <xsl:value-of select="."/>\r
530                                         </placeCode>\r
531                                 </xsl:for-each>\r
532 \r
533                                 <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a' or @code='b' or @code='c' or @code='g']">\r
534                                         <xsl:choose>\r
535                                                 <xsl:when test="@code='a'">\r
536                                                         <place>\r
537                                                                 <xsl:call-template name="chopPunctuation">\r
538                                                                         <xsl:with-param name="chopString" select="."/>\r
539                                                                 </xsl:call-template>\r
540                                                         </place>\r
541                                                 </xsl:when>\r
542                                                 <xsl:when test="@code='b'">\r
543                                                         <publisher>\r
544                                                                 <xsl:call-template name="chopPunctuation">\r
545                                                                         <xsl:with-param name="chopString" select="."/>\r
546                                                                 </xsl:call-template>\r
547                                                         </publisher>\r
548                                                 </xsl:when>\r
549                                                 <xsl:when test="@code='c'">\r
550                                                         <dateIssued>\r
551                                                                 <xsl:call-template name="chopPunctuation">\r
552                                                                         <xsl:with-param name="chopString" select="."/>\r
553                                                                 </xsl:call-template>\r
554                                                         </dateIssued>\r
555                                                 </xsl:when>\r
556                                                 <xsl:when test="@code='g'">\r
557                                                         <dateCreated>\r
558                                                                 <xsl:value-of select="."/>\r
559                                                         </dateCreated>                  \r
560                                                 </xsl:when>\r
561                                         </xsl:choose>\r
562                                 </xsl:for-each>\r
563 \r
564                                 <xsl:variable name="dataField260c">\r
565                                         <xsl:call-template name="chopPunctuation">\r
566                                                 <xsl:with-param name="chopString" select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/>\r
567                                         </xsl:call-template>\r
568                                 </xsl:variable>\r
569 \r
570                                 <xsl:variable name="controlField008-7-10" select="normalize-space(substring($controlField008, 8, 4))"/>\r
571                                 <xsl:variable name="controlField008-11-14" select="normalize-space(substring($controlField008, 12, 4))"/>\r
572                                 <xsl:variable name="controlField008-6" select="normalize-space(substring($controlField008, 7, 1))"/>\r
573                 \r
574                                 <xsl:if test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">\r
575                                         <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">\r
576                                                 <dateIssued encoding="marc">\r
577                                                         <xsl:value-of select="$controlField008-7-10"/>\r
578                                                 </dateIssued>\r
579                                         </xsl:if>\r
580                                 </xsl:if>\r
581                 \r
582                                 <xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">\r
583                                         <xsl:if test="$controlField008-7-10">\r
584                                                 <dateIssued encoding="marc" point="start">\r
585                                                         <xsl:value-of select="$controlField008-7-10"/>\r
586                                                 </dateIssued>\r
587                                         </xsl:if>\r
588                                 </xsl:if>\r
589 \r
590                                 <xsl:if test="$controlField008-6='c' or $controlField008-6='d' or $controlField008-6='i' or $controlField008-6='k' or $controlField008-6='m' or $controlField008-6='q' or $controlField008-6='u'">\r
591                                         <xsl:if test="$controlField008-11-14">\r
592                                                 <dateIssued encoding="marc" point="end">\r
593                                                         <xsl:value-of select="$controlField008-11-14"/>\r
594                                                 </dateIssued>\r
595                                         </xsl:if>\r
596                                 </xsl:if>\r
597 \r
598                                 <xsl:for-each select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">\r
599                                         <dateCaptured encoding="iso8601">\r
600                                                 <xsl:value-of select="."/>\r
601                                         </dateCaptured>\r
602                                 </xsl:for-each>\r
603 \r
604                                 <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">\r
605                                         <dateCaptured encoding="iso8601" point="start">\r
606                                                 <xsl:value-of select="."/>\r
607                                         </dateCaptured>\r
608                                 </xsl:for-each>\r
609 \r
610                                 <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">\r
611                                         <dateCaptured encoding="iso8601" point="end">\r
612                                                 <xsl:value-of select="."/>\r
613                                         </dateCaptured>\r
614                                 </xsl:for-each>\r
615 \r
616                                 <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">\r
617                                         <edition>\r
618                                                 <xsl:value-of select="."/>\r
619                                         </edition>\r
620                                 </xsl:for-each>\r
621 \r
622                                 <xsl:for-each select="marc:leader">\r
623                                         <issuance>\r
624                                                 <xsl:choose>\r
625                                                         <xsl:when test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">monographic</xsl:when>\r
626                                                         <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">continuing</xsl:when>                                                     \r
627                                                 </xsl:choose>\r
628                                         </issuance>\r
629                                 </xsl:for-each>         \r
630                                 \r
631                                 <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">\r
632                                         <frequency>\r
633                                                 <xsl:call-template name="subfieldSelect">\r
634                                                         <xsl:with-param name="codes">ab</xsl:with-param>\r
635                                                 </xsl:call-template>\r
636                                         </frequency>\r
637                                 </xsl:for-each>                                                         \r
638                         </publicationInfo>\r
639 \r
640 \r
641                         <xsl:for-each select="marc:controlfield[@tag=041]">\r
642                                 <xsl:for-each select="marc:subfield[@code='a' or @code='d' or @code='e']">\r
643                                         <language>\r
644                                                 <xsl:choose>\r
645                                                         <xsl:when test="../marc:subfield[@code='2']">\r
646                                                                 <xsl:attribute name="authority">rfc3066</xsl:attribute>\r
647                                                         </xsl:when>\r
648                                                         <xsl:otherwise>\r
649                                                                 <xsl:attribute name="authority">iso639-2b</xsl:attribute>                                               \r
650                                                         </xsl:otherwise>\r
651                                                 </xsl:choose>\r
652                                                 <xsl:value-of select="text()"/>\r
653                                         </language>\r
654                                 </xsl:for-each>\r
655                         </xsl:for-each>                 \r
656 \r
657                         <xsl:variable name="controlField008-35-37" select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>\r
658                         <xsl:if test="$controlField008-35-37">\r
659                                 <language authority="iso639-2b">\r
660                                         <xsl:value-of select="substring($controlField008,36,3)"/>\r
661                                 </language>\r
662                         </xsl:if>\r
663 \r
664                         <xsl:variable name="physicalDescription">\r
665                                 <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a' or substring(.,12,1)='b']">\r
666                                         <digitalOrigin>reformatted digital</digitalOrigin>\r
667                                 </xsl:if>\r
668 \r
669                                 <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>\r
670                                 <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>\r
671 \r
672                                 <xsl:variable name="check008-23">\r
673                                         <xsl:if test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">\r
674                                                 <xsl:value-of select="true()"/>\r
675                                         </xsl:if>\r
676                                 </xsl:variable>\r
677 \r
678                                 <xsl:variable name="check008-29">\r
679                                         <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">\r
680                                                 <xsl:value-of select="true()"/>\r
681                                         </xsl:if>\r
682                                 </xsl:variable>\r
683 \r
684                                 <xsl:choose>\r
685                                         <xsl:when test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">\r
686                                                 <form><controlled>braille</controlled></form>\r
687                                         </xsl:when>\r
688                                         <xsl:when test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">\r
689                                                 <form><controlled>electronic</controlled></form>\r
690                                         </xsl:when>\r
691                                         <xsl:when test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">\r
692                                                 <form><controlled>microfiche</controlled></form>\r
693                                         </xsl:when>\r
694                                         <xsl:when test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">\r
695                                                 <form><controlled>microfilm</controlled></form>\r
696                                         </xsl:when>\r
697                                 </xsl:choose>\r
698 \r
699                                 <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)>1]">\r
700                                         <internetMediaType>\r
701                                                 <xsl:value-of select="."/>\r
702                                         </internetMediaType>\r
703                                 </xsl:for-each>\r
704 \r
705                                 <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">\r
706                                         <form>\r
707                                                 <unControlled>\r
708                                                         <xsl:value-of select="."/>\r
709                                                 </unControlled>\r
710                                         </form>\r
711                                 </xsl:for-each>\r
712 \r
713                                 <xsl:for-each select="marc:datafield[@tag=300]">\r
714                                         <extent>\r
715                                                 <xsl:call-template name="subfieldSelect">\r
716                                                         <xsl:with-param name="codes">abce</xsl:with-param>\r
717                                                 </xsl:call-template>\r
718                                         </extent>\r
719                                 </xsl:for-each>\r
720                         </xsl:variable>\r
721 \r
722                         <xsl:if test="string-length(normalize-space($physicalDescription))">\r
723                                 <physicalDescription>\r
724                                         <xsl:copy-of select="$physicalDescription"/>\r
725                                 </physicalDescription>\r
726                         </xsl:if>\r
727 \r
728                         <xsl:for-each select="marc:datafield[@tag=520]">\r
729                                 <abstract>\r
730                                         <xsl:call-template name="uri"/>\r
731                                         <xsl:call-template name="subfieldSelect">\r
732                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
733                                         </xsl:call-template>\r
734                                 </abstract>\r
735                         </xsl:for-each>\r
736 \r
737                         <xsl:for-each select="marc:datafield[@tag=505]">\r
738                                 <tableOfContents>\r
739                                         <xsl:call-template name="uri"/>\r
740                                         <xsl:call-template name="subfieldSelect">\r
741                                                 <xsl:with-param name="codes">agrt</xsl:with-param>\r
742                                         </xsl:call-template>\r
743                                 </tableOfContents>\r
744                         </xsl:for-each>\r
745 \r
746                         <xsl:for-each select="marc:datafield[@tag=521]">\r
747                                 <targetAudience>\r
748                                         <xsl:call-template name="subfieldSelect">\r
749                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
750                                         </xsl:call-template>\r
751                                 </targetAudience>\r
752                         </xsl:for-each>\r
753 \r
754                         <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">\r
755                                 <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>\r
756                                 <xsl:choose>\r
757                                         <xsl:when test="$controlField008-22='d'">\r
758                                                 <targetAudience>adolescent</targetAudience>\r
759                                         </xsl:when>\r
760                                         <xsl:when test="$controlField008-22='e'">\r
761                                                 <targetAudience>adult</targetAudience>\r
762                                         </xsl:when>\r
763                                         <xsl:when test="$controlField008-22='g'">\r
764                                                 <targetAudience>general</targetAudience>\r
765                                         </xsl:when>\r
766                                         <xsl:when test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">\r
767                                                 <targetAudience>juvenile</targetAudience>\r
768                                         </xsl:when>\r
769                                         <xsl:when test="$controlField008-22='a'">\r
770                                                 <targetAudience>preschool</targetAudience>\r
771                                         </xsl:when>\r
772                                         <xsl:when test="$controlField008-22='f'">\r
773                                                 <targetAudience>specialized</targetAudience>\r
774                                         </xsl:when>\r
775                                 </xsl:choose>\r
776                         </xsl:if>\r
777 \r
778                         <!-- Not in mapping but in conversion -->\r
779                         <xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">\r
780                                 <note type="statement of responsibility">\r
781                                         <xsl:value-of select="."/>\r
782                                 </note>\r
783                         </xsl:for-each>\r
784 \r
785                         <xsl:for-each select="marc:datafield[@tag=500]">\r
786                                 <note>\r
787                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
788                                         <xsl:call-template name="uri"/>\r
789                                 </note>\r
790                         </xsl:for-each>\r
791 \r
792                         <xsl:for-each select="marc:datafield[@tag=511]">\r
793                                 <note type="performers">\r
794                                         <xsl:call-template name="uri"/>\r
795                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
796                                 </note>\r
797                         </xsl:for-each>\r
798 \r
799                         <xsl:for-each select="marc:datafield[@tag=518]">\r
800                                 <note type="venue">\r
801                                         <xsl:call-template name="uri"/>\r
802                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
803                                 </note>\r
804                         </xsl:for-each>\r
805 \r
806                         <xsl:for-each select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=506 or @tag=507 or @tag=508 or @tag=510 or @tag=513 or @tag=514 or @tag=515 or @tag=516 or @tag=522 or @tag=524 or @tag=525 or @tag=526 or @tag=530 or @tag=533 or @tag=534 or @tag=535 or @tag=536 or @tag=538 or @tag=540 or @tag=541 or @tag=544 or @tag=545 or @tag=546 or @tag=547 or @tag=550 or @tag=552 or @tag=555 or @tag=556 or @tag=561 or @tag=562 or @tag=565 or @tag=567 or @tag=580 or @tag=581 or @tag=583 or @tag=584 or @tag=585 or @tag=586]">\r
807                                 <note>\r
808                                         <xsl:call-template name="uri"/>\r
809                                         <xsl:variable name="str">\r
810                                                 <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">\r
811                                                         <xsl:value-of select="."/><xsl:text> </xsl:text>\r
812                                                 </xsl:for-each>\r
813                                         </xsl:variable>\r
814                                         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>\r
815                                 </note>\r
816                         </xsl:for-each>\r
817 \r
818                         <xsl:for-each select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">\r
819                                 <cartographics>\r
820                                         <coordinates>\r
821                                                 <xsl:call-template name="subfieldSelect">\r
822                                                         <xsl:with-param name="codes">defg</xsl:with-param>\r
823                                                 </xsl:call-template>\r
824                                         </coordinates>\r
825                                 </cartographics>\r
826                         </xsl:for-each>\r
827 \r
828                         <xsl:for-each select="marc:datafield[@tag=255]">\r
829                                 <cartographics>\r
830                                         <xsl:for-each select="marc:subfield[@code='c']">\r
831                                                 <coordinates>\r
832                                                         <xsl:value-of select="."/>\r
833                                                 </coordinates>\r
834                                         </xsl:for-each>\r
835                                         <xsl:for-each select="marc:subfield[@code='a']">\r
836                                                 <scale>\r
837                                                         <xsl:value-of select="."/>\r
838                                                 </scale>\r
839                                         </xsl:for-each>\r
840                                         <xsl:for-each select="marc:subfield[@code='b']">\r
841                                                 <projection>\r
842                                                         <xsl:value-of select="."/>\r
843                                                 </projection>   \r
844                                         </xsl:for-each>\r
845                                 </cartographics>\r
846                         </xsl:for-each>\r
847 \r
848                         <xsl:apply-templates select="marc:datafield[653 >= @tag and @tag >= 600]"/>\r
849 \r
850                         <xsl:for-each select="marc:datafield[@tag=752]">\r
851                                 <subject>\r
852                                         <hierarchicalGeographic>\r
853                                                 <xsl:for-each select="marc:subfield[@code='a']">\r
854                                                         <country>\r
855                                                                 <xsl:value-of select="."/>\r
856                                                         </country>\r
857                                                 </xsl:for-each>         \r
858                                                 <xsl:for-each select="marc:subfield[@code='b']">\r
859                                                         <state>\r
860                                                                 <xsl:value-of select="."/>\r
861                                                         </state>\r
862                                                 </xsl:for-each>         \r
863                                                 <xsl:for-each select="marc:subfield[@code='c']">\r
864                                                         <county>\r
865                                                                 <xsl:value-of select="."/>\r
866                                                         </county>\r
867                                                 </xsl:for-each>         \r
868                                                 <xsl:for-each select="marc:subfield[@code='d']">\r
869                                                         <city>\r
870                                                                 <xsl:value-of select="."/>\r
871                                                         </city>\r
872                                                 </xsl:for-each>         \r
873                                         </hierarchicalGeographic>\r
874                                 </subject>\r
875                         </xsl:for-each>\r
876 \r
877                         <xsl:for-each select="marc:datafield[@tag=050]">\r
878                                 <xsl:for-each select="marc:subfield[@code='b']">\r
879                                         <classification authority="lcc">\r
880                                                 <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>\r
881                                                 <xsl:text> </xsl:text>\r
882                                                 <xsl:value-of select="text()"/>\r
883                                         </classification>\r
884                                 </xsl:for-each>\r
885                                 <xsl:for-each select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">\r
886                                         <classification authority="lcc">\r
887                                                 <xsl:value-of select="text()"/>\r
888                                         </classification>\r
889                                 </xsl:for-each>\r
890                         </xsl:for-each>\r
891 \r
892                         <xsl:for-each select="marc:datafield[@tag=082]">\r
893                                 <classification authority="ddc">\r
894                                         <xsl:if test="marc:subfield[@code='2']">\r
895                                                 <xsl:attribute name="edition">\r
896                                                         <xsl:value-of select="marc:subfield[@code='2']"/>\r
897                                                 </xsl:attribute>\r
898                                         </xsl:if>\r
899                                         <xsl:call-template name="subfieldSelect">\r
900                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
901                                         </xsl:call-template>\r
902                                 </classification>\r
903                         </xsl:for-each>\r
904 \r
905                         <xsl:for-each select="marc:datafield[@tag=080]">\r
906                                 <classification authority="udc">\r
907                                         <xsl:call-template name="subfieldSelect">\r
908                                                 <xsl:with-param name="codes">abx</xsl:with-param>\r
909                                         </xsl:call-template>\r
910                                 </classification>\r
911                         </xsl:for-each>\r
912 \r
913                         <xsl:for-each select="marc:datafield[@tag=060]">\r
914                                 <classification authority="nlm">\r
915                                         <xsl:call-template name="subfieldSelect">\r
916                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
917                                         </xsl:call-template>\r
918                                 </classification>\r
919                         </xsl:for-each>\r
920 \r
921                         <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">\r
922                                 <classification authority="sudocs">\r
923                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
924                                 </classification>\r
925                         </xsl:for-each>\r
926 \r
927                         <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">\r
928                                 <classification authority="candoc">\r
929                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
930                                 </classification>\r
931                         </xsl:for-each>\r
932 \r
933                         <xsl:for-each select="marc:datafield[@tag=086]">\r
934                                 <classification>\r
935                                         <xsl:attribute name="authority">\r
936                                                 <xsl:value-of select="marc:subfield[@code='2']"/>\r
937                                         </xsl:attribute>                                                \r
938                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
939                                 </classification>\r
940                         </xsl:for-each>\r
941 \r
942                         <xsl:for-each select="marc:datafield[@tag=084]">\r
943                                 <classification>\r
944                                         <xsl:attribute name="authority">\r
945                                                 <xsl:value-of select="marc:subfield[@code='2']"/>\r
946                                         </xsl:attribute>\r
947                                         <xsl:call-template name="subfieldSelect">\r
948                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
949                                         </xsl:call-template>\r
950                                 </classification>\r
951                         </xsl:for-each>\r
952 \r
953                         <xsl:for-each select="marc:datafield[@tag=440]">\r
954                                 <relatedItem type="series">\r
955                                         <titleInfo>\r
956                                                 <title>\r
957                                                         <xsl:call-template name="subfieldSelect">\r
958                                                                 <xsl:with-param name="codes">av</xsl:with-param>\r
959                                                         </xsl:call-template>\r
960                                                         <xsl:call-template name="part"/>\r
961                                                 </title>\r
962                                         </titleInfo>\r
963                                 </relatedItem>  \r
964                         </xsl:for-each>\r
965 \r
966                         <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">\r
967                                 <relatedItem type="series">\r
968                                         <titleInfo>\r
969                                                 <title>\r
970                                                         <xsl:call-template name="subfieldSelect">\r
971                                                                 <xsl:with-param name="codes">av</xsl:with-param>\r
972                                                         </xsl:call-template>\r
973                                                         <xsl:call-template name="part"/>\r
974                                                 </title>\r
975                                         </titleInfo>\r
976                                 </relatedItem>  \r
977                         </xsl:for-each>\r
978 \r
979                         <xsl:for-each select="marc:datafield[@tag=534]">\r
980                                 <relatedItem type="original">\r
981                                         <xsl:call-template name="relatedTitle"/>\r
982                                         <xsl:call-template name="relatedName"/>\r
983                                         <xsl:call-template name="relatedIdentifierISSN"/>\r
984                                         <xsl:for-each select="marc:subfield[@code='z']">\r
985                                                 <identifier type="isbn">\r
986                                                         <xsl:value-of select="."/>\r
987                                                 </identifier>\r
988                                         </xsl:for-each>\r
989                                         <xsl:call-template name="relatedNote"/>\r
990                                 </relatedItem>  \r
991                         </xsl:for-each>\r
992 \r
993                         <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">\r
994                                 <relatedItem>\r
995                                         <xsl:call-template name="constituentOrRelatedType"/>\r
996                                         <titleInfo>\r
997                                                 <title>\r
998                                                         <xsl:call-template name="specialSubfieldSelect">\r
999                                                                 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>\r
1000                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1001                                                                 <xsl:with-param name="afterCodes">g</xsl:with-param>\r
1002                                                         </xsl:call-template>\r
1003                                                 </title>\r
1004                                                 <xsl:call-template name="part"/>\r
1005                                         </titleInfo>\r
1006                                         <name type="personal">\r
1007                                                 <namePart>\r
1008                                                         <xsl:call-template name="specialSubfieldSelect">\r
1009                                                                 <xsl:with-param name="anyCodes">abcq</xsl:with-param>\r
1010                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1011                                                                 <xsl:with-param name="beforeCodes">g</xsl:with-param>\r
1012                                                         </xsl:call-template>                                                    \r
1013                                                 </namePart>\r
1014                                                 <xsl:call-template name="nameDate"/>\r
1015                                                 <xsl:for-each select="marc:subfield[@code='e']">\r
1016                                                         <role>\r
1017                                                                 <xsl:value-of select="."/>\r
1018                                                         </role>\r
1019                                                 </xsl:for-each>\r
1020                                         </name>\r
1021                                         <xsl:call-template name="relatedForm"/>\r
1022                                         <xsl:call-template name="relatedIdentifierISSN"/>\r
1023                                 </relatedItem>\r
1024                         </xsl:for-each>\r
1025 \r
1026                         <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">\r
1027                                 <relatedItem>\r
1028                                         <xsl:call-template name="constituentOrRelatedType"/>\r
1029                                         <titleInfo>\r
1030                                                 <title>\r
1031                                                         <xsl:call-template name="specialSubfieldSelect">\r
1032                                                                 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>\r
1033                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1034                                                                 <xsl:with-param name="afterCodes">dg</xsl:with-param>\r
1035                                                         </xsl:call-template>\r
1036                                                 </title>\r
1037                                                 <xsl:call-template name="relatedPart"/>\r
1038                                         </titleInfo>\r
1039                                         <name type="corporate">\r
1040                                                 <xsl:for-each select="marc:subfield[@code='a']">\r
1041                                                         <namePart>\r
1042                                                                 <xsl:value-of select="."/>\r
1043                                                         </namePart>\r
1044                                                 </xsl:for-each>\r
1045                                                 <xsl:for-each select="marc:subfield[@code='b']">\r
1046                                                         <namePart>\r
1047                                                                 <xsl:value-of select="."/>\r
1048                                                         </namePart>\r
1049                                                 </xsl:for-each>\r
1050                                                 <xsl:variable name="tempNamePart">\r
1051                                                         <xsl:call-template name="specialSubfieldSelect">\r
1052                                                                 <xsl:with-param name="anyCodes">c</xsl:with-param>\r
1053                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1054                                                                 <xsl:with-param name="beforeCodes">dgn</xsl:with-param>\r
1055                                                         </xsl:call-template>                                                    \r
1056                                                 </xsl:variable>\r
1057                                                 <xsl:if test="normalize-space($tempNamePart)">\r
1058                                                         <namePart>\r
1059                                                                 <xsl:value-of select="$tempNamePart"/>\r
1060                                                         </namePart>\r
1061                                                 </xsl:if>\r
1062                                                 <xsl:for-each select="marc:subfield[@code='e']">\r
1063                                                         <role>\r
1064                                                                 <xsl:value-of select="."/>\r
1065                                                         </role>\r
1066                                                 </xsl:for-each>\r
1067                                         </name>\r
1068                                         <xsl:call-template name="relatedForm"/>\r
1069                                         <xsl:call-template name="relatedIdentifierISSN"/>\r
1070                                 </relatedItem>\r
1071                         </xsl:for-each>\r
1072 \r
1073                         <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">\r
1074                                 <relatedItem>\r
1075                                         <xsl:call-template name="constituentOrRelatedType"/>\r
1076                                         <titleInfo>\r
1077                                                 <title>\r
1078                                                         <xsl:call-template name="specialSubfieldSelect">\r
1079                                                                 <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>\r
1080                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1081                                                                 <xsl:with-param name="afterCodes">g</xsl:with-param>\r
1082                                                         </xsl:call-template>\r
1083                                                 </title>\r
1084                                                 <xsl:call-template name="relatedPart"/>\r
1085                                         </titleInfo>\r
1086                                         <name type="conference">\r
1087                                                 <namePart>\r
1088                                                         <xsl:call-template name="specialSubfieldSelect">\r
1089                                                                 <xsl:with-param name="anyCodes">aqdc</xsl:with-param>\r
1090                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1091                                                                 <xsl:with-param name="beforeCodes">gn</xsl:with-param>\r
1092                                                         </xsl:call-template>                                                    \r
1093                                                 </namePart>\r
1094                                         </name>\r
1095                                         <xsl:call-template name="relatedForm"/>\r
1096                                         <xsl:call-template name="relatedIdentifierISSN"/>\r
1097                                 </relatedItem>\r
1098                         </xsl:for-each>\r
1099 \r
1100                         <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">\r
1101                                 <relatedItem>\r
1102                                         <xsl:call-template name="constituentOrRelatedType"/>\r
1103                                         <titleInfo>\r
1104                                                 <title>\r
1105                                                         <xsl:call-template name="subfieldSelect">\r
1106                                                                 <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>\r
1107                                                         </xsl:call-template>\r
1108                                                 </title>\r
1109                                                 <xsl:call-template name="part"/>\r
1110                                         </titleInfo>\r
1111                                         <xsl:call-template name="relatedForm"/>\r
1112                                         <xsl:call-template name="relatedIdentifierISSN"/>\r
1113                                 </relatedItem>\r
1114                         </xsl:for-each>\r
1115 \r
1116                         <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">\r
1117                                 <relatedItem>\r
1118                                         <xsl:call-template name="constituentOrRelatedType"/>\r
1119                                         <titleInfo>\r
1120                                                 <title>                                 \r
1121                                                         <xsl:value-of select="marc:subfield[@code='a']"/>\r
1122                                                 </title>\r
1123                                                 <xsl:call-template name="part"/>\r
1124                                         </titleInfo>\r
1125                                         <xsl:call-template name="relatedForm"/>\r
1126                                 </relatedItem>\r
1127                         </xsl:for-each>\r
1128 \r
1129                         <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">\r
1130                                 <relatedItem type="series">\r
1131                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1132                                 </relatedItem>  \r
1133                         </xsl:for-each>\r
1134 \r
1135                         <xsl:for-each select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=775]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">\r
1136                                 <relatedItem type="related">\r
1137                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1138                                 </relatedItem>  \r
1139                         </xsl:for-each>\r
1140 \r
1141                         <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">\r
1142                                 <relatedItem type="constituent">\r
1143                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1144                                 </relatedItem>  \r
1145                         </xsl:for-each>\r
1146 \r
1147                         <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">\r
1148                                 <relatedItem type="host">\r
1149                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1150                                 </relatedItem>  \r
1151                         </xsl:for-each>\r
1152 \r
1153                         <xsl:for-each select="marc:datafield[@tag=776]">\r
1154                                 <relatedItem type="reproduction">\r
1155                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1156                                 </relatedItem>  \r
1157                         </xsl:for-each>\r
1158 \r
1159                         <xsl:for-each select="marc:datafield[@tag=780]">\r
1160                                 <relatedItem type="preceding">\r
1161                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1162                                 </relatedItem>  \r
1163                         </xsl:for-each>\r
1164 \r
1165                         <xsl:for-each select="marc:datafield[@tag=785]">\r
1166                                 <relatedItem type="succeeding">\r
1167                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1168                                 </relatedItem>  \r
1169                         </xsl:for-each>\r
1170 \r
1171                         <xsl:for-each select="marc:datafield[@tag=786]">\r
1172                                 <relatedItem type="original">\r
1173                                         <xsl:call-template name="relatedItem76X-78X"/>\r
1174                                 </relatedItem>  \r
1175                         </xsl:for-each>\r
1176 \r
1177                         <xsl:for-each select="marc:datafield[@tag=800]">\r
1178                                 <relatedItem type="series">\r
1179                                         <titleInfo>\r
1180                                                 <title>\r
1181                                                         <xsl:call-template name="specialSubfieldSelect">\r
1182                                                                 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>\r
1183                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1184                                                                 <xsl:with-param name="afterCodes">g</xsl:with-param>\r
1185                                                         </xsl:call-template>\r
1186                                                 </title>\r
1187                                                 <xsl:call-template name="part"/>\r
1188                                         </titleInfo>\r
1189                                         <name type="personal">\r
1190                                                 <namePart>\r
1191                                                         <xsl:call-template name="chopPunctuation">\r
1192                                                                 <xsl:with-param name="chopString">\r
1193                                                                         <xsl:call-template name="specialSubfieldSelect">\r
1194                                                                                 <xsl:with-param name="anyCodes">abcq</xsl:with-param>\r
1195                                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1196                                                                                 <xsl:with-param name="beforeCodes">g</xsl:with-param>\r
1197                                                                         </xsl:call-template>\r
1198                                                                 </xsl:with-param>\r
1199                                                         </xsl:call-template>\r
1200                                                 </namePart>\r
1201                                                 <xsl:call-template name="nameDate"/>\r
1202                                                 <xsl:for-each select="marc:subfield[@code='e']">\r
1203                                                         <role>\r
1204                                                                 <xsl:value-of select="."/>\r
1205                                                         </role>\r
1206                                                 </xsl:for-each>\r
1207                                         </name>\r
1208                                         <xsl:call-template name="relatedForm"/>\r
1209                                 </relatedItem>\r
1210                         </xsl:for-each>\r
1211 \r
1212                         <xsl:for-each select="marc:datafield[@tag=810]">\r
1213                                 <relatedItem type="series">\r
1214                                         <titleInfo>\r
1215                                                 <title>\r
1216                                                         <xsl:call-template name="specialSubfieldSelect">\r
1217                                                                 <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>\r
1218                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1219                                                                 <xsl:with-param name="afterCodes">dg</xsl:with-param>\r
1220                                                         </xsl:call-template>\r
1221                                                 </title>\r
1222                                                 <xsl:call-template name="relatedPart"/>\r
1223                                         </titleInfo>\r
1224                                         <name type="corporate">\r
1225                                                 <xsl:for-each select="marc:subfield[@code='a']">\r
1226                                                         <namePart>\r
1227                                                                 <xsl:value-of select="."/>\r
1228                                                         </namePart>\r
1229                                                 </xsl:for-each>\r
1230                                                 <xsl:for-each select="marc:subfield[@code='b']">\r
1231                                                         <namePart>\r
1232                                                                 <xsl:value-of select="."/>\r
1233                                                         </namePart>\r
1234                                                 </xsl:for-each>\r
1235                                                 <namePart>\r
1236                                                         <xsl:call-template name="specialSubfieldSelect">\r
1237                                                                 <xsl:with-param name="anyCodes">c</xsl:with-param>\r
1238                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1239                                                                 <xsl:with-param name="beforeCodes">dgn</xsl:with-param>\r
1240                                                         </xsl:call-template>                                                    \r
1241                                                 </namePart>\r
1242                                                 <xsl:for-each select="marc:subfield[@code='e']">\r
1243                                                         <role>\r
1244                                                                 <xsl:value-of select="."/>\r
1245                                                         </role>\r
1246                                                 </xsl:for-each>\r
1247                                         </name>\r
1248                                         <xsl:call-template name="relatedForm"/>\r
1249                                 </relatedItem>  \r
1250                         </xsl:for-each>\r
1251 \r
1252                         <xsl:for-each select="marc:datafield[@tag=811]">\r
1253                                 <relatedItem type="series">\r
1254                                         <titleInfo>\r
1255                                                 <title>\r
1256                                                         <xsl:call-template name="specialSubfieldSelect">\r
1257                                                                 <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>\r
1258                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1259                                                                 <xsl:with-param name="afterCodes">g</xsl:with-param>\r
1260                                                         </xsl:call-template>\r
1261                                                 </title>\r
1262                                                 <xsl:call-template name="relatedPart"/>\r
1263                                         </titleInfo>\r
1264                                         <name type="conference">\r
1265                                                 <namePart>\r
1266                                                         <xsl:call-template name="specialSubfieldSelect">\r
1267                                                                 <xsl:with-param name="anyCodes">aqdc</xsl:with-param>\r
1268                                                                 <xsl:with-param name="axis">t</xsl:with-param>\r
1269                                                                 <xsl:with-param name="beforeCodes">gn</xsl:with-param>\r
1270                                                         </xsl:call-template>                                                    \r
1271                                                 </namePart>\r
1272                                         </name>\r
1273                                         <xsl:call-template name="relatedForm"/>\r
1274                                 </relatedItem>  \r
1275                         </xsl:for-each>\r
1276 \r
1277                         <xsl:for-each select="marc:datafield[@tag=830]">\r
1278                                 <relatedItem type="series">\r
1279                                         <titleInfo>\r
1280                                                 <title>\r
1281                                                         <xsl:call-template name="subfieldSelect">\r
1282                                                                 <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>\r
1283                                                         </xsl:call-template>\r
1284                                                 </title>\r
1285                                                 <xsl:call-template name="part"/>\r
1286                                         </titleInfo>\r
1287                                         <xsl:call-template name="relatedForm"/>\r
1288                                 </relatedItem>  \r
1289                         </xsl:for-each>\r
1290 \r
1291                         <xsl:for-each select="marc:datafield[@tag=856][@ind2=2]/marc:subfield[@code='q']">\r
1292                                 <relatedItem>\r
1293                                         <internetMediaType>\r
1294                                                 <xsl:value-of select="."/>\r
1295                                         </internetMediaType>\r
1296                                 </relatedItem>  \r
1297                         </xsl:for-each>\r
1298 \r
1299                         <xsl:for-each select="marc:datafield[@tag=020]/marc:subfield[@code='a']">\r
1300                                 <identifier type="isbn">\r
1301                                         <xsl:value-of select="."/>\r
1302                                 </identifier>\r
1303                         </xsl:for-each>\r
1304 \r
1305                         <xsl:for-each select="marc:datafield[@tag=024][@ind1=0]/marc:subfield[@code='a']">\r
1306                                 <identifier type="isrc">\r
1307                                         <xsl:value-of select="."/>\r
1308                                 </identifier>\r
1309                         </xsl:for-each>\r
1310 \r
1311                         <xsl:for-each select="marc:datafield[@tag=024][@ind1=2]/marc:subfield[@code='a']">\r
1312                                 <identifier type="ismn">\r
1313                                         <xsl:value-of select="."/>\r
1314                                 </identifier>\r
1315                         </xsl:for-each>\r
1316 \r
1317                         <xsl:for-each select="marc:datafield[@tag=022]/marc:subfield[@code='a']">\r
1318                                 <identifier type="issn">\r
1319                                         <xsl:value-of select="."/>\r
1320                                 </identifier>\r
1321                         </xsl:for-each>\r
1322 \r
1323                         <xsl:for-each select="marc:datafield[@tag=010]/marc:subfield[@code='a']">\r
1324                                 <identifier type="lccn">\r
1325                                         <xsl:value-of select="normalize-space(text())"/>\r
1326                                 </identifier>\r
1327                         </xsl:for-each>\r
1328 \r
1329                         <xsl:for-each select="marc:datafield[@tag=028]">\r
1330                                 <identifier>\r
1331                                         <xsl:attribute name="type">\r
1332                                                 <xsl:choose>\r
1333                                                         <xsl:when test="@ind1=0">issue number</xsl:when>\r
1334                                                         <xsl:when test="@ind1=1">matrix number</xsl:when>\r
1335                                                         <xsl:when test="@ind1=2">music plate</xsl:when>\r
1336                                                         <xsl:when test="@ind1=3">music publisher</xsl:when>\r
1337                                                         <xsl:when test="@ind1=4">videorecording identifier</xsl:when>\r
1338                                                 </xsl:choose>\r
1339                                         </xsl:attribute>\r
1340                                         <xsl:call-template name="subfieldSelect">\r
1341                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
1342                                         </xsl:call-template>\r
1343                                 </identifier>\r
1344                         </xsl:for-each>\r
1345                 \r
1346                         <xsl:for-each select="marc:datafield[@tag=024][@ind1=4]">\r
1347                                 <identifier type="sici">\r
1348                                         <xsl:call-template name="subfieldSelect">\r
1349                                                 <xsl:with-param name="codes">ab</xsl:with-param>\r
1350                                         </xsl:call-template>\r
1351                                 </identifier>\r
1352                         </xsl:for-each>\r
1353 \r
1354                         <xsl:for-each select="marc:datafield[@tag=856]/marc:subfield[@code='u']">\r
1355                                 <identifier>\r
1356                                         <xsl:attribute name="type">\r
1357                                                 <xsl:choose>\r
1358                                                         <xsl:when test="starts-with(.,'urn:doi') or starts-with(.,'doi:')">doi</xsl:when>\r
1359                                                         <xsl:otherwise>uri</xsl:otherwise>\r
1360                                                 </xsl:choose>\r
1361                                         </xsl:attribute>\r
1362                                         <xsl:value-of select="."/>\r
1363                                 </identifier>\r
1364                         </xsl:for-each>\r
1365 \r
1366                         <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]/marc:subfield[@code='a']">\r
1367                                 <identifier type="upc">\r
1368                                         <xsl:value-of select="."/>\r
1369                                 </identifier>\r
1370                         </xsl:for-each>\r
1371 \r
1372                         <xsl:for-each select="marc:datafield[@tag=852]">\r
1373                                 <location>\r
1374                                         <xsl:call-template name="subfieldSelect">\r
1375                                                 <xsl:with-param name="codes">abj</xsl:with-param>\r
1376                                         </xsl:call-template>\r
1377                                 </location>\r
1378                         </xsl:for-each>\r
1379 \r
1380                         <xsl:for-each select="marc:datafield[@tag=506]">\r
1381                                 <accessCondition type="restrictionOnAccess">\r
1382                                         <xsl:call-template name="subfieldSelect">\r
1383                                                 <xsl:with-param name="codes">abcd35</xsl:with-param>\r
1384                                         </xsl:call-template>\r
1385                                 </accessCondition>\r
1386                         </xsl:for-each>\r
1387 \r
1388                         <xsl:for-each select="marc:datafield[@tag=540]">\r
1389                                 <accessCondition type="useAndReproduction">\r
1390                                         <xsl:call-template name="subfieldSelect">\r
1391                                                 <xsl:with-param name="codes">abcde35</xsl:with-param>\r
1392                                         </xsl:call-template>\r
1393                                 </accessCondition>\r
1394                         </xsl:for-each>\r
1395 \r
1396                         <recordInfo>\r
1397                                 <xsl:for-each select="marc:datafield[@tag=040]">\r
1398                                         <recordContentSource>\r
1399                                                 <xsl:value-of select="marc:subfield[@code='a']"/>\r
1400                                         </recordContentSource>\r
1401                                 </xsl:for-each>\r
1402 \r
1403                                 <xsl:for-each select="marc:controlfield[@tag=008]">\r
1404                                         <recordCreationDate encoding="marc">\r
1405                                                 <xsl:value-of select="substring(.,1,6)"/>\r
1406                                         </recordCreationDate>\r
1407                                 </xsl:for-each>         \r
1408                         \r
1409                                 <xsl:for-each select="marc:controlfield[@tag=005]">\r
1410                                         <recordChangeDate encoding="iso8601">\r
1411                                                 <xsl:value-of select="."/>\r
1412                                         </recordChangeDate>\r
1413                                 </xsl:for-each>\r
1414 \r
1415                                 <xsl:for-each select="marc:controlfield[@tag=001]">\r
1416                                         <recordIdentifier>\r
1417                                                 <xsl:if test="../marc:controlfield[@tag=003]">\r
1418                                                         <xsl:attribute name="source">\r
1419                                                                 <xsl:value-of select="../marc:controlfield[@tag=003]"/>\r
1420                                                         </xsl:attribute>\r
1421                                                 </xsl:if>\r
1422                                                 <xsl:value-of select="."/>\r
1423                                         </recordIdentifier>\r
1424                                 </xsl:for-each>\r
1425                         </recordInfo>\r
1426                 </mods>\r
1427         </xsl:template>\r
1428 \r
1429         <xsl:template name="displayForm">\r
1430                 <xsl:for-each select="marc:subfield[@code='c']">\r
1431                         <displayForm>\r
1432                                 <xsl:value-of select="."/>\r
1433                         </displayForm>\r
1434                 </xsl:for-each>\r
1435         </xsl:template>\r
1436 \r
1437         <xsl:template name="affiliation">\r
1438                 <xsl:for-each select="marc:subfield[@code='u']">\r
1439                         <affiliation>\r
1440                                 <xsl:value-of select="."/>\r
1441                         </affiliation>\r
1442                 </xsl:for-each>\r
1443         </xsl:template>\r
1444 \r
1445         <xsl:template name="uri">\r
1446                 <xsl:for-each select="marc:subfield[@code='u']">\r
1447                         <xsl:attribute name="xlink:href">\r
1448                                 <xsl:value-of select="."/>\r
1449                         </xsl:attribute>\r
1450                 </xsl:for-each>\r
1451         </xsl:template>\r
1452 \r
1453         <xsl:template name="role">\r
1454                 <xsl:choose>\r
1455                         <xsl:when test="marc:subfield[@code='e']">\r
1456                                 <role><xsl:value-of select="marc:subfield[@code='e']"/></role>\r
1457                         </xsl:when>\r
1458                         <xsl:when test="marc:subfield[@code='4']">\r
1459                                 <xsl:for-each select="marc:subfield[@code='4']">\r
1460                                         <role><xsl:value-of select="text()"/></role>\r
1461                                 </xsl:for-each>\r
1462                         </xsl:when>\r
1463                 </xsl:choose>\r
1464         </xsl:template>\r
1465 \r
1466         <xsl:template name="part">\r
1467                 <xsl:variable name="partNumber">\r
1468                         <xsl:call-template name="specialSubfieldSelect">\r
1469                                 <xsl:with-param name="axis">n</xsl:with-param>\r
1470                                 <xsl:with-param name="anyCodes">n</xsl:with-param>\r
1471                                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>\r
1472                         </xsl:call-template>\r
1473                 </xsl:variable>\r
1474                 <xsl:variable name="partName">\r
1475                         <xsl:call-template name="specialSubfieldSelect">\r
1476                                 <xsl:with-param name="axis">p</xsl:with-param>\r
1477                                 <xsl:with-param name="anyCodes">p</xsl:with-param>\r
1478                                 <xsl:with-param name="afterCodes">fghkdlmor</xsl:with-param>\r
1479                         </xsl:call-template>\r
1480                 </xsl:variable>\r
1481                 <xsl:if test="string-length(normalize-space($partNumber))">\r
1482                         <partNumber>\r
1483                                 <xsl:value-of select="$partNumber"/>\r
1484                         </partNumber>\r
1485                 </xsl:if>\r
1486                 <xsl:if test="string-length(normalize-space($partName))">\r
1487                         <partName>\r
1488                                 <xsl:value-of select="$partName"/>\r
1489                         </partName>\r
1490                 </xsl:if>\r
1491         </xsl:template>\r
1492 \r
1493         <xsl:template name="relatedPart">\r
1494                 <xsl:for-each select="marc:subfield[@code='n'][preceding-sibling::marc:subfield[@code='t']]">\r
1495                         <partNumber>\r
1496                                 <xsl:value-of select="."/>\r
1497                         </partNumber>\r
1498                 </xsl:for-each>\r
1499                 <xsl:for-each select="marc:subfield[@code='p']">\r
1500                         <partName>\r
1501                                 <xsl:value-of select="."/>\r
1502                         </partName>\r
1503                 </xsl:for-each>\r
1504         </xsl:template>\r
1505 \r
1506         <xsl:template name="relatedName">\r
1507                 <xsl:for-each select="marc:subfield[@code='a']">\r
1508                         <name>\r
1509                                 <namePart>\r
1510                                         <xsl:value-of select="."/>\r
1511                                 </namePart>\r
1512                         </name>\r
1513                 </xsl:for-each>\r
1514         </xsl:template>\r
1515 \r
1516         <xsl:template name="relatedForm">\r
1517                 <xsl:for-each select="marc:subfield[@code='h']">\r
1518                         <physicalDescription>\r
1519                                 <form>\r
1520                                         <unControlled>\r
1521                                                 <xsl:value-of select="."/>\r
1522                                         </unControlled>\r
1523                                 </form>\r
1524                         </physicalDescription>\r
1525                 </xsl:for-each>\r
1526         </xsl:template>\r
1527 \r
1528         <xsl:template name="relatedExtent">\r
1529                 <xsl:for-each select="marc:subfield[@code='h']">\r
1530                         <physicalDescription>\r
1531                                 <extent>\r
1532                                         <xsl:value-of select="."/>\r
1533                                 </extent>\r
1534                         </physicalDescription>\r
1535                 </xsl:for-each>\r
1536         </xsl:template>\r
1537 \r
1538         <xsl:template name="relatedNote">\r
1539                 <xsl:for-each select="marc:subfield[@code='n']">\r
1540                         <note>\r
1541                                 <xsl:value-of select="."/>\r
1542                         </note>\r
1543                 </xsl:for-each>\r
1544         </xsl:template>\r
1545 \r
1546         <xsl:template name="relatedIdentifierISSN">\r
1547                 <xsl:for-each select="marc:subfield[@code='x']">\r
1548                         <identifier type="issn">\r
1549                                 <xsl:value-of select="."/>\r
1550                         </identifier>\r
1551                 </xsl:for-each>\r
1552         </xsl:template>\r
1553 \r
1554         <xsl:template name="relatedIdentifierLocal">\r
1555                 <xsl:for-each select="marc:subfield[@code='w']">\r
1556                         <identifier type="local">\r
1557                                 <xsl:value-of select="."/>\r
1558                         </identifier>\r
1559                 </xsl:for-each>\r
1560         </xsl:template>\r
1561 \r
1562         <xsl:template name="relatedIdentifier">\r
1563                 <xsl:for-each select="marc:subfield[@code='o']">\r
1564                         <identifier>\r
1565                                 <xsl:value-of select="."/>\r
1566                         </identifier>\r
1567                 </xsl:for-each>\r
1568         </xsl:template>\r
1569 \r
1570         <xsl:template name="relatedItem76X-78X">\r
1571                 <xsl:call-template name="relatedTitle76X-78X"/>\r
1572                 <xsl:call-template name="relatedName"/>\r
1573                 <xsl:call-template name="relatedExtent"/>\r
1574                 <xsl:call-template name="relatedIdentifier"/>\r
1575                 <xsl:call-template name="relatedIdentifierISSN"/>\r
1576                 <xsl:call-template name="relatedIdentifierLocal"/>\r
1577                 <xsl:call-template name="relatedNote"/>\r
1578         </xsl:template>\r
1579 \r
1580         <xsl:template name="subjectGeographicZ">\r
1581                 <geographic>\r
1582                         <xsl:value-of select="."/>\r
1583                 </geographic>                   \r
1584         </xsl:template>\r
1585 \r
1586         <xsl:template name="subjectTemporalY">\r
1587                 <temporal>\r
1588                         <xsl:value-of select="."/>\r
1589                 </temporal>                     \r
1590         </xsl:template>\r
1591 \r
1592         <xsl:template name="subjectTopic">\r
1593                 <topic>\r
1594                         <xsl:call-template name="chopPunctuation">\r
1595                                 <xsl:with-param name="chopString" select="."/>\r
1596                         </xsl:call-template>\r
1597                 </topic>\r
1598         </xsl:template>\r
1599 \r
1600         <xsl:template name="nameABCDN">\r
1601                 <xsl:for-each select="marc:subfield[@code='a']">\r
1602                         <namePart>\r
1603                                 <xsl:call-template name="chopPunctuation">\r
1604                                         <xsl:with-param name="chopString" select="."/>\r
1605                                 </xsl:call-template>\r
1606                         </namePart>                                     \r
1607                 </xsl:for-each>\r
1608                 <xsl:for-each select="marc:subfield[@code='b']">\r
1609                         <namePart>\r
1610                                 <xsl:value-of select="."/>\r
1611                         </namePart>                                     \r
1612                 </xsl:for-each>\r
1613                 <xsl:if test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">\r
1614                         <namePart>\r
1615                                 <xsl:call-template name="subfieldSelect">\r
1616                                         <xsl:with-param name="codes">cdn</xsl:with-param>\r
1617                                 </xsl:call-template>\r
1618                         </namePart>\r
1619                 </xsl:if>\r
1620         </xsl:template>\r
1621 \r
1622         <xsl:template name="nameABCDQ">\r
1623                 <namePart>\r
1624                         <xsl:call-template name="chopPunctuation">\r
1625                                 <xsl:with-param name="chopString">\r
1626                                         <xsl:call-template name="subfieldSelect">\r
1627                                                 <xsl:with-param name="codes">abcq</xsl:with-param>\r
1628                                         </xsl:call-template>\r
1629                                 </xsl:with-param>\r
1630                         </xsl:call-template>\r
1631                 </namePart>\r
1632                 <xsl:call-template name="nameDate"/>\r
1633         </xsl:template>\r
1634 \r
1635         <xsl:template name="nameACDEQ">\r
1636                 <namePart>\r
1637                         <xsl:call-template name="subfieldSelect">\r
1638                                 <xsl:with-param name="codes">acdeq</xsl:with-param>\r
1639                         </xsl:call-template>\r
1640                 </namePart>\r
1641         </xsl:template>\r
1642 \r
1643         <xsl:template name="constituentOrRelatedType">\r
1644                 <xsl:attribute name="type">\r
1645                         <xsl:choose>\r
1646                                 <xsl:when test="@ind2=2">constituent</xsl:when>\r
1647                                 <xsl:otherwise>related</xsl:otherwise>\r
1648                         </xsl:choose>\r
1649                 </xsl:attribute>\r
1650         </xsl:template>\r
1651 \r
1652         <xsl:template name="relatedTitle">\r
1653                 <xsl:for-each select="marc:subfield[@code='t']">\r
1654                         <titleInfo>\r
1655                                 <title>\r
1656                                         <xsl:value-of select="."/>\r
1657                                 </title>\r
1658                         </titleInfo>\r
1659                 </xsl:for-each>\r
1660         </xsl:template>\r
1661 \r
1662         <xsl:template name="relatedTitle76X-78X">\r
1663                 <titleInfo>\r
1664                         <xsl:for-each select="marc:subfield[@code='t']">\r
1665                                 <title>\r
1666                                         <xsl:value-of select="."/>\r
1667                                 </title>\r
1668                         </xsl:for-each>\r
1669                         <xsl:for-each select="marc:subfield[@code='g']">\r
1670                                 <partNumber>\r
1671                                         <xsl:value-of select="."/>\r
1672                                 </partNumber>\r
1673                         </xsl:for-each>\r
1674                 </titleInfo>\r
1675         </xsl:template>\r
1676 \r
1677         <xsl:template name="nameDate">\r
1678                 <xsl:for-each select="marc:subfield[@code='d']">\r
1679                         <namePart type="date">\r
1680                                 <xsl:call-template name="chopPunctuation">\r
1681                                         <xsl:with-param name="chopString" select="."/>\r
1682                                 </xsl:call-template>\r
1683                         </namePart>\r
1684                 </xsl:for-each>\r
1685         </xsl:template>\r
1686 \r
1687         <xsl:template name="subjectAuthority">\r
1688                 <xsl:attribute name="authority">\r
1689                         <xsl:choose>\r
1690                         <xsl:when test="@ind2=0">lcsh</xsl:when>\r
1691                         <xsl:when test="@ind2=1">lcshac</xsl:when>\r
1692                         <xsl:when test="@ind2=2">mesh</xsl:when>\r
1693                         <xsl:when test="@ind2=3">csh</xsl:when>\r
1694                         <xsl:when test="@ind2=5">nal</xsl:when>\r
1695                         <xsl:when test="@ind2=6">rvm</xsl:when>\r
1696                         <xsl:when test="@ind2=7"><xsl:value-of select="marc:subfield[@code='2']"/></xsl:when>\r
1697                         </xsl:choose>\r
1698                 </xsl:attribute>\r
1699         </xsl:template>\r
1700 \r
1701         <xsl:template name="subjectAnyOrder">\r
1702                 <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">\r
1703                         <xsl:choose>\r
1704                                 <xsl:when test="@code='v'">\r
1705                                         <xsl:call-template name="subjectTopic"/>\r
1706                                 </xsl:when>\r
1707                                 <xsl:when test="@code='x'">\r
1708                                         <xsl:call-template name="subjectTopic"/>\r
1709                                 </xsl:when>\r
1710                                 <xsl:when test="@code='y'">\r
1711                                         <xsl:call-template name="subjectTemporalY"/>\r
1712                                 </xsl:when>\r
1713                                 <xsl:when test="@code='z'">\r
1714                                         <xsl:call-template name="subjectGeographicZ"/>\r
1715                                 </xsl:when>\r
1716                         </xsl:choose>\r
1717                 </xsl:for-each>\r
1718         </xsl:template>\r
1719 \r
1720 <!--    <xsl:template name="subfieldSelect">\r
1721                 <xsl:param name="codes"/>\r
1722                 <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param>\r
1723                 <xsl:variable name="str">\r
1724                         <xsl:for-each select="marc:subfield">\r
1725                                 <xsl:if test="contains($codes, @code)">\r
1726                                         <xsl:value-of select="text()"/><xsl:value-of select="$delimeter"/>\r
1727                                 </xsl:if>\r
1728                         </xsl:for-each>\r
1729                 </xsl:variable>\r
1730                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>\r
1731         </xsl:template>\r
1732 -->\r
1733 \r
1734         <xsl:template name="specialSubfieldSelect">\r
1735                 <xsl:param name="anyCodes"/>\r
1736                 <xsl:param name="axis"/>\r
1737                 <xsl:param name="beforeCodes"/>\r
1738                 <xsl:param name="afterCodes"/>\r
1739                 <xsl:variable name="str">\r
1740                         <xsl:for-each select="marc:subfield">\r
1741                                 <xsl:if test="contains($anyCodes, @code) or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis]) or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">\r
1742                                         <xsl:value-of select="text()"/><xsl:text> </xsl:text>\r
1743                                 </xsl:if>\r
1744                         </xsl:for-each>\r
1745                 </xsl:variable>\r
1746                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>\r
1747         </xsl:template>\r
1748 \r
1749         <xsl:template match="marc:datafield[@tag=600]">\r
1750                 <subject>\r
1751                         <xsl:call-template name="subjectAuthority"/>\r
1752                         <name type="personal">\r
1753                                 <namePart>\r
1754                                         <xsl:call-template name="chopPunctuation">\r
1755                                                 <xsl:with-param name="chopString">\r
1756                                                         <xsl:call-template name="subfieldSelect">\r
1757                                                                 <xsl:with-param name="codes">abcq</xsl:with-param>\r
1758                                                         </xsl:call-template>\r
1759                                                 </xsl:with-param>\r
1760                                         </xsl:call-template>\r
1761                                 </namePart>\r
1762                                 <xsl:call-template name="nameDate"/>\r
1763                                 <xsl:call-template name="affiliation"/>\r
1764                                 <xsl:call-template name="role"/>\r
1765                         </name>\r
1766                         <xsl:call-template name="subjectAnyOrder"/>\r
1767                 </subject>\r
1768         </xsl:template>\r
1769 \r
1770         <xsl:template match="marc:datafield[@tag=610]">\r
1771                 <subject>\r
1772                         <xsl:call-template name="subjectAuthority"/>\r
1773                         <name type="corporate">\r
1774                                 <xsl:for-each select="marc:subfield[@code='a']">\r
1775                                         <namePart>\r
1776                                                 <xsl:value-of select="."/>\r
1777                                         </namePart>\r
1778                                 </xsl:for-each>\r
1779                                 <xsl:for-each select="marc:subfield[@code='b']">\r
1780                                         <namePart>\r
1781                                                 <xsl:value-of select="."/>\r
1782                                         </namePart>\r
1783                                 </xsl:for-each>\r
1784                                 <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">\r
1785                                         <namePart>\r
1786                                                 <xsl:call-template name="subfieldSelect">\r
1787                                                         <xsl:with-param name="codes">cdnp</xsl:with-param>\r
1788                                                 </xsl:call-template>\r
1789                                         </namePart>\r
1790                                 </xsl:if>\r
1791                                 <xsl:call-template name="role"/>\r
1792                         </name>\r
1793                         <xsl:call-template name="subjectAnyOrder"/>\r
1794                 </subject>\r
1795         </xsl:template>\r
1796 \r
1797         <xsl:template match="marc:datafield[@tag=611]">\r
1798                 <subject>\r
1799                         <xsl:call-template name="subjectAuthority"/>\r
1800                         <name type="conference">\r
1801                                 <namePart>\r
1802                                         <xsl:call-template name="subfieldSelect">\r
1803                                                 <xsl:with-param name="codes">abcdeqnp</xsl:with-param>\r
1804                                         </xsl:call-template>\r
1805                                 </namePart>\r
1806                                 <xsl:for-each select="marc:subfield[@code='4']">\r
1807                                         <role>\r
1808                                                 <xsl:value-of select="."/>\r
1809                                         </role>\r
1810                                 </xsl:for-each>\r
1811                         </name>\r
1812                         <xsl:call-template name="subjectAnyOrder"/>\r
1813                 </subject>\r
1814         </xsl:template>\r
1815 \r
1816         <xsl:template match="marc:datafield[@tag=630]">\r
1817                 <subject>\r
1818                         <xsl:call-template name="subjectAuthority"/>\r
1819                         <titleInfo>\r
1820                                 <title>\r
1821                                         <xsl:call-template name="subfieldSelect">\r
1822                                                 <xsl:with-param name="codes">adfhklor</xsl:with-param>\r
1823                                         </xsl:call-template>\r
1824                                         <xsl:call-template name="part"/>                        \r
1825                                 </title>\r
1826                         </titleInfo>\r
1827                         <xsl:call-template name="subjectAnyOrder"/>\r
1828                 </subject>\r
1829         </xsl:template>\r
1830 \r
1831         <xsl:template match="marc:datafield[@tag=650]">\r
1832                 <subject>\r
1833                         <xsl:call-template name="subjectAuthority"/>\r
1834                         <topic>\r
1835                                 <xsl:call-template name="chopPunctuation">\r
1836                                         <xsl:with-param name="chopString">\r
1837                                                 <xsl:call-template name="subfieldSelect">\r
1838                                                         <xsl:with-param name="codes">abcd</xsl:with-param>\r
1839                                                 </xsl:call-template>\r
1840                                         </xsl:with-param>\r
1841                                 </xsl:call-template>\r
1842                         </topic>\r
1843                         <xsl:call-template name="subjectAnyOrder"/>\r
1844                 </subject>\r
1845         </xsl:template>\r
1846 \r
1847 \r
1848         <xsl:template match="marc:datafield[@tag=651]">\r
1849                 <subject>\r
1850                         <xsl:call-template name="subjectAuthority"/>\r
1851                         <xsl:for-each select="marc:subfield[@code='a']">\r
1852                                 <geographic>\r
1853                                         <xsl:value-of select="."/>\r
1854                                 </geographic>                   \r
1855                         </xsl:for-each>\r
1856                         <xsl:call-template name="subjectAnyOrder"/>\r
1857                 </subject>\r
1858         </xsl:template>\r
1859 \r
1860         <xsl:template match="marc:datafield[@tag=653]">\r
1861                 <subject>\r
1862                         <xsl:for-each select="marc:subfield[@code='a']">\r
1863                                 <topic>\r
1864                                         <xsl:value-of select="."/>\r
1865                                 </topic>                        \r
1866                         </xsl:for-each>\r
1867                 </subject>\r
1868         </xsl:template>\r
1869 </xsl:stylesheet><!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.\r
1870 <metaInformation>\r
1871 <scenarios ><scenario default="yes" name="modstst2" userelativepaths="yes" externalpreview="no" url="..\..\..\..\..\..\marcxml\modstst2.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="modstest" userelativepaths="yes" externalpreview="no" url="..\..\..\..\..\..\marcxml\modstest.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/><scenario default="no" name="Scenario1" userelativepaths="yes" externalpreview="no" url="..\..\..\..\..\..\marcxml\t.xml" htmlbaseurl="" outputurl="" processortype="internal" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>\r
1872 </metaInformation>\r
1873 -->