Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac
[working/Evergreen.git] / Open-ILS / xsl / MARC21slim2MODS33.xsl
1 <xsl:stylesheet xmlns="http://www.loc.gov/mods/v3" xmlns:marc="http://www.loc.gov/MARC21/slim"
2         xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3         exclude-result-prefixes="xlink marc" version="1.0">
4         <xsl:include href="MARC21slimUtils.xsl"/>
5         <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
6
7         <!--MARC21slim2MODS3-3.xsl
8 Revision 1.27 - Mapped 648 to <subject> 2009/03/13 tmee
9 Revision 1.26 - Added subfield $s mapping for 130/240/730  2008/10/16 tmee
10 Revision 1.25 - Mapped 040e to <descriptiveStandard> and Leader/18 to <descriptive standard>aacr2  2008/09/18 tmee
11 Revision 1.24 - Mapped 852 subfields $h, $i, $j, $k, $l, $m, $t to <shelfLocation> and 852 subfield $u to <physicalLocation> with @xlink 2008/09/17 tmee
12 Revision 1.23 - Commented out xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711 as these are currently unactionable  2008/09/17  tmee
13 Revision 1.22 - Mapped 022 subfield $l to type "issn-l" subfield $m to output identifier element with corresponding @type and @invalid eq 'yes'2008/09/17  tmee
14 Revision 1.21 - Mapped 856 ind2=1 or ind2=2 to <relatedItem><location><url>  2008/07/03  tmee
15 Revision 1.20 - Added genre w/@auth="contents of 2" and type= "musical composition"  2008/07/01  tmee
16 Revision 1.19 - Added genre offprint for 008/24+ BK code 2  2008/07/01  tmee
17 Revision 1.18 - Added xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711  2008/06/26  tmee
18 Revision 1.17 - Added mapping of 662 2008/05/14 tmee    
19 Revision 1.16 - Changed @authority from "marc" to "marcgt" for 007 and 008 codes mapped to a term in <genre> 2007/07/10  tmee
20 Revision 1.15 - For field 630, moved call to part template outside title element  2007/07/10  tmee
21 Revision 1.14 - Fixed template isValid and fields 010, 020, 022, 024, 028, and 037 to output additional identifier elements with corresponding @type and @invalid eq 'yes' when subfields z or y (in the case of 022) exist in the MARCXML ::: 2007/01/04 17:35:20 cred
22 Revision 1.13 - Changed order of output under cartographics to reflect schema  2006/11/28  tmee
23 Revision 1.12 - Updated to reflect MODS 3.2 Mapping  2006/10/11  tmee
24 Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language>  2006/04/08  jrad
25 Revision 1.10 - MODS 3.1 revisions to language and classification elements  (plus ability to find marc:collection embedded in wrapper elements such as SRU zs: wrappers)  2006/02/06  ggar
26 Revision 1.9 - Subfield $y was added to field 242 2004/09/02 10:57 jrad
27 Revision 1.8 - Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
28 Revision 1.7 - 2004/03/25 08:29 jrad
29 Revision 1.6 - Various validation fixes 2004/02/20 ntra
30 Revision 1.5 - MODS2 to MODS3 updates, language unstacking and de-duping, chopPunctuation expanded  2003/10/02 16:18:58  ntra
31 Revision 1.3 - Additional Changes not related to MODS Version 2.0 by ntra
32 Revision 1.2 - Added Log Comment  2003/03/24 19:37:42  ckeith
33 -->
34         <xsl:template match="/">
35                 <xsl:choose>
36                         <xsl:when test="//marc:collection">
37                                 <modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
38                                         xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
39                                         <xsl:for-each select="//marc:collection/marc:record">
40                                                 <mods version="3.3">
41                                                         <xsl:call-template name="marcRecord"/>
42                                                 </mods>
43                                         </xsl:for-each>
44                                 </modsCollection>
45                         </xsl:when>
46                         <xsl:otherwise>
47                                 <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3"
48                                         xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
49                                         <xsl:for-each select="//marc:record">
50                                                 <xsl:call-template name="marcRecord"/>
51                                         </xsl:for-each>
52                                 </mods>
53                         </xsl:otherwise>
54                 </xsl:choose>
55         </xsl:template>
56         <xsl:template name="marcRecord">
57                 <xsl:variable name="leader" select="marc:leader"/>
58                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
59                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
60                 <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/>
61                 <xsl:variable name="typeOf008">
62                         <xsl:choose>
63                                 <xsl:when test="$leader6='a'">
64                                         <xsl:choose>
65                                                 <xsl:when
66                                                         test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
67                                                 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
68                                         </xsl:choose>
69                                 </xsl:when>
70                                 <xsl:when test="$leader6='t'">BK</xsl:when>
71                                 <xsl:when test="$leader6='p'">MM</xsl:when>
72                                 <xsl:when test="$leader6='m'">CF</xsl:when>
73                                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
74                                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
75                                 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'"
76                                 >MU</xsl:when>
77                         </xsl:choose>
78                 </xsl:variable>
79                 <xsl:for-each select="marc:datafield[@tag='245']">
80                         <titleInfo>
81                                 <xsl:variable name="title">
82                                         <xsl:choose>
83                                                 <xsl:when test="marc:subfield[@code='b']">
84                                                         <xsl:call-template name="specialSubfieldSelect">
85                                                                 <xsl:with-param name="axis">b</xsl:with-param>
86                                                                 <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
87                                                         </xsl:call-template>
88                                                 </xsl:when>
89                                                 <xsl:otherwise>
90                                                         <xsl:call-template name="subfieldSelect">
91                                                                 <xsl:with-param name="codes">abfgk</xsl:with-param>
92                                                         </xsl:call-template>
93                                                 </xsl:otherwise>
94                                         </xsl:choose>
95                                 </xsl:variable>
96                                 <xsl:variable name="titleChop">
97                                         <xsl:call-template name="chopPunctuation">
98                                                 <xsl:with-param name="chopString">
99                                                         <xsl:value-of select="$title"/>
100                                                 </xsl:with-param>
101                                         </xsl:call-template>
102                                 </xsl:variable>
103                                 <xsl:choose>
104                                         <xsl:when test="@ind2&gt;0">
105                                                 <nonSort>
106                                                         <xsl:value-of select="substring($titleChop,1,@ind2)"/>
107                                                 </nonSort>
108                                                 <title>
109                                                         <xsl:value-of select="substring($titleChop,@ind2+1)"/>
110                                                 </title>
111                                         </xsl:when>
112                                         <xsl:otherwise>
113                                                 <title>
114                                                         <xsl:value-of select="$titleChop"/>
115                                                 </title>
116                                         </xsl:otherwise>
117                                 </xsl:choose>
118                                 <xsl:if test="marc:subfield[@code='b']">
119                                         <subTitle>
120                                                 <xsl:call-template name="chopPunctuation">
121                                                         <xsl:with-param name="chopString">
122                                                                 <xsl:call-template name="specialSubfieldSelect">
123                                                                         <xsl:with-param name="axis">b</xsl:with-param>
124                                                                         <xsl:with-param name="anyCodes">b</xsl:with-param>
125                                                                         <xsl:with-param name="afterCodes">afgk</xsl:with-param>
126                                                                 </xsl:call-template>
127                                                         </xsl:with-param>
128                                                 </xsl:call-template>
129                                         </subTitle>
130                                 </xsl:if>
131                                 <xsl:call-template name="part"/>
132                         </titleInfo>
133                 </xsl:for-each>
134                 <xsl:for-each select="marc:datafield[@tag='210']">
135                         <titleInfo type="abbreviated">
136                                 <title>
137                                         <xsl:call-template name="chopPunctuation">
138                                                 <xsl:with-param name="chopString">
139                                                         <xsl:call-template name="subfieldSelect">
140                                                                 <xsl:with-param name="codes">a</xsl:with-param>
141                                                         </xsl:call-template>
142                                                 </xsl:with-param>
143                                         </xsl:call-template>
144                                 </title>
145                                 <xsl:call-template name="subtitle"/>
146                         </titleInfo>
147                 </xsl:for-each>
148                 <xsl:for-each select="marc:datafield[@tag='242']">
149                         <titleInfo type="translated">
150                                 <!--09/01/04 Added subfield $y-->
151                                 <xsl:for-each select="marc:subfield[@code='y']">
152                                         <xsl:attribute name="lang">
153                                                 <xsl:value-of select="text()"/>
154                                         </xsl:attribute>
155                                 </xsl:for-each>
156                                 <xsl:for-each select="marc:subfield[@code='i']">
157                                         <xsl:attribute name="displayLabel">
158                                                 <xsl:value-of select="text()"/>
159                                         </xsl:attribute>
160                                 </xsl:for-each>
161                                 <title>
162                                         <xsl:call-template name="chopPunctuation">
163                                                 <xsl:with-param name="chopString">
164                                                         <xsl:call-template name="subfieldSelect">
165                                                                 <!-- 1/04 removed $h, b -->
166                                                                 <xsl:with-param name="codes">a</xsl:with-param>
167                                                         </xsl:call-template>
168                                                 </xsl:with-param>
169                                         </xsl:call-template>
170                                 </title>
171                                 <!-- 1/04 fix -->
172                                 <xsl:call-template name="subtitle"/>
173                                 <xsl:call-template name="part"/>
174                         </titleInfo>
175                 </xsl:for-each>
176                 <xsl:for-each select="marc:datafield[@tag='246']">
177                         <titleInfo type="alternative">
178                                 <xsl:for-each select="marc:subfield[@code='i']">
179                                         <xsl:attribute name="displayLabel">
180                                                 <xsl:value-of select="text()"/>
181                                         </xsl:attribute>
182                                 </xsl:for-each>
183                                 <title>
184                                         <xsl:call-template name="chopPunctuation">
185                                                 <xsl:with-param name="chopString">
186                                                         <xsl:call-template name="subfieldSelect">
187                                                                 <!-- 1/04 removed $h, $b -->
188                                                                 <xsl:with-param name="codes">af</xsl:with-param>
189                                                         </xsl:call-template>
190                                                 </xsl:with-param>
191                                         </xsl:call-template>
192                                 </title>
193                                 <xsl:call-template name="subtitle"/>
194                                 <xsl:call-template name="part"/>
195                         </titleInfo>
196                 </xsl:for-each>
197                 <xsl:for-each
198                         select="marc:datafield[@tag='130']|marc:datafield[@tag='240']|marc:datafield[@tag='730'][@ind2!='2']">
199                         <titleInfo type="uniform">
200                                 <title>
201                                         <!-- deleted uri for subfield 0
202                                                 <xsl:call-template name="uri"/>
203                                         -->
204
205                                         <xsl:variable name="str">
206                                                 <xsl:for-each select="marc:subfield">
207                                                         <xsl:if
208                                                                 test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
209                                                                 <xsl:value-of select="text()"/>
210                                                                 <xsl:text> </xsl:text>
211                                                         </xsl:if>
212                                                 </xsl:for-each>
213                                         </xsl:variable>
214                                         <xsl:call-template name="chopPunctuation">
215                                                 <xsl:with-param name="chopString">
216                                                         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
217                                                 </xsl:with-param>
218                                         </xsl:call-template>
219                                 </title>
220                                 <xsl:call-template name="part"/>
221                         </titleInfo>
222                 </xsl:for-each>
223                 <xsl:for-each select="marc:datafield[@tag='740'][@ind2!='2']">
224                         <titleInfo type="alternative">
225                                 <title>
226                                         <xsl:call-template name="chopPunctuation">
227                                                 <xsl:with-param name="chopString">
228                                                         <xsl:call-template name="subfieldSelect">
229                                                                 <xsl:with-param name="codes">ah</xsl:with-param>
230                                                         </xsl:call-template>
231                                                 </xsl:with-param>
232                                         </xsl:call-template>
233                                 </title>
234                                 <xsl:call-template name="part"/>
235                         </titleInfo>
236                 </xsl:for-each>
237                 <xsl:for-each select="marc:datafield[@tag='100']">
238                         <name type="personal">
239
240                                 <!-- deleted uri for subfield 0
241                                 <xsl:call-template name="uri"/>
242                                 -->
243
244                                 <xsl:call-template name="nameABCDQ"/>
245                                 <xsl:call-template name="affiliation"/>
246                                 <role>
247                                         <roleTerm authority="marcrelator" type="text">creator</roleTerm>
248                                 </role>
249                                 <xsl:call-template name="role"/>
250                         </name>
251                 </xsl:for-each>
252                 <xsl:for-each select="marc:datafield[@tag='110']">
253                         <name type="corporate">
254
255                                 <!-- deleted uri for subfield 0
256                                         <xsl:call-template name="uri"/>
257                                 -->
258
259                                 <xsl:call-template name="nameABCDN"/>
260                                 <role>
261                                         <roleTerm authority="marcrelator" type="text">creator</roleTerm>
262                                 </role>
263                                 <xsl:call-template name="role"/>
264                         </name>
265                 </xsl:for-each>
266                 <xsl:for-each select="marc:datafield[@tag='111']">
267                         <name type="conference">
268
269                                 <!-- deleted uri for subfield 0
270                                         <xsl:call-template name="uri"/>
271                                 -->
272
273                                 <xsl:call-template name="nameACDEQ"/>
274                                 <role>
275                                         <roleTerm authority="marcrelator" type="text">creator</roleTerm>
276                                 </role>
277                                 <xsl:call-template name="role"/>
278                         </name>
279                 </xsl:for-each>
280                 <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]">
281                         <name type="personal">
282
283                                 <!-- deleted uri for subfield 0
284                                         <xsl:call-template name="uri"/>
285                                 -->
286
287                                 <xsl:call-template name="nameABCDQ"/>
288                                 <xsl:call-template name="affiliation"/>
289                                 <xsl:call-template name="role"/>
290                         </name>
291                 </xsl:for-each>
292                 <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]">
293                         <name type="corporate">
294
295                                 <!-- deleted uri for subfield 0
296                                         <xsl:call-template name="uri"/>
297                                 -->
298
299                                 <xsl:call-template name="nameABCDN"/>
300                                 <xsl:call-template name="role"/>
301                         </name>
302                 </xsl:for-each>
303                 <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]">
304                         <name type="conference">
305
306                                 <!-- deleted uri for subfield 0
307                                         <xsl:call-template name="uri"/>
308                                 -->
309
310                                 <xsl:call-template name="nameACDEQ"/>
311                                 <xsl:call-template name="role"/>
312                         </name>
313                 </xsl:for-each>
314                 <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]">
315                         <name>
316                                 <xsl:if test="@ind1=1">
317                                         <xsl:attribute name="type">
318                                                 <xsl:text>personal</xsl:text>
319                                         </xsl:attribute>
320                                 </xsl:if>
321                                 <namePart>
322                                         <xsl:value-of select="marc:subfield[@code='a']"/>
323                                 </namePart>
324                                 <xsl:call-template name="role"/>
325                         </name>
326                 </xsl:for-each>
327                 <typeOfResource>
328                         <xsl:if test="$leader7='c'">
329                                 <xsl:attribute name="collection">yes</xsl:attribute>
330                         </xsl:if>
331                         <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
332                                 <xsl:attribute name="manuscript">yes</xsl:attribute>
333                         </xsl:if>
334                         <xsl:choose>
335                                 <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
336                                 <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
337                                 <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
338                                 <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
339                                 <xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
340                                 <xsl:when test="$leader6='k'">still image</xsl:when>
341                                 <xsl:when test="$leader6='g'">moving image</xsl:when>
342                                 <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
343                                 <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
344                                 <xsl:when test="$leader6='p'">mixed material</xsl:when>
345                         </xsl:choose>
346                 </typeOfResource>
347                 <xsl:if test="substring($controlField008,26,1)='d'">
348                         <genre authority="marcgt">globe</genre>
349                 </xsl:if>
350                 <xsl:if
351                         test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
352                         <genre authority="marcgt">remote-sensing image</genre>
353                 </xsl:if>
354                 <xsl:if test="$typeOf008='MP'">
355                         <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>
356                         <xsl:choose>
357                                 <xsl:when
358                                         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']">
359                                         <genre authority="marcgt">map</genre>
360                                 </xsl:when>
361                                 <xsl:when
362                                         test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
363                                         <genre authority="marcgt">atlas</genre>
364                                 </xsl:when>
365                         </xsl:choose>
366                 </xsl:if>
367                 <xsl:if test="$typeOf008='SE'">
368                         <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
369                         <xsl:choose>
370                                 <xsl:when test="$controlField008-21='d'">
371                                         <genre authority="marcgt">database</genre>
372                                 </xsl:when>
373                                 <xsl:when test="$controlField008-21='l'">
374                                         <genre authority="marcgt">loose-leaf</genre>
375                                 </xsl:when>
376                                 <xsl:when test="$controlField008-21='m'">
377                                         <genre authority="marcgt">series</genre>
378                                 </xsl:when>
379                                 <xsl:when test="$controlField008-21='n'">
380                                         <genre authority="marcgt">newspaper</genre>
381                                 </xsl:when>
382                                 <xsl:when test="$controlField008-21='p'">
383                                         <genre authority="marcgt">periodical</genre>
384                                 </xsl:when>
385                                 <xsl:when test="$controlField008-21='w'">
386                                         <genre authority="marcgt">web site</genre>
387                                 </xsl:when>
388                         </xsl:choose>
389                 </xsl:if>
390                 <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
391                         <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
392                         <xsl:choose>
393                                 <xsl:when test="contains($controlField008-24,'a')">
394                                         <genre authority="marcgt">abstract or summary</genre>
395                                 </xsl:when>
396                                 <xsl:when test="contains($controlField008-24,'b')">
397                                         <genre authority="marcgt">bibliography</genre>
398                                 </xsl:when>
399                                 <xsl:when test="contains($controlField008-24,'c')">
400                                         <genre authority="marcgt">catalog</genre>
401                                 </xsl:when>
402                                 <xsl:when test="contains($controlField008-24,'d')">
403                                         <genre authority="marcgt">dictionary</genre>
404                                 </xsl:when>
405                                 <xsl:when test="contains($controlField008-24,'e')">
406                                         <genre authority="marcgt">encyclopedia</genre>
407                                 </xsl:when>
408                                 <xsl:when test="contains($controlField008-24,'f')">
409                                         <genre authority="marcgt">handbook</genre>
410                                 </xsl:when>
411                                 <xsl:when test="contains($controlField008-24,'g')">
412                                         <genre authority="marcgt">legal article</genre>
413                                 </xsl:when>
414                                 <xsl:when test="contains($controlField008-24,'i')">
415                                         <genre authority="marcgt">index</genre>
416                                 </xsl:when>
417                                 <xsl:when test="contains($controlField008-24,'k')">
418                                         <genre authority="marcgt">discography</genre>
419                                 </xsl:when>
420                                 <xsl:when test="contains($controlField008-24,'l')">
421                                         <genre authority="marcgt">legislation</genre>
422                                 </xsl:when>
423                                 <xsl:when test="contains($controlField008-24,'m')">
424                                         <genre authority="marcgt">theses</genre>
425                                 </xsl:when>
426                                 <xsl:when test="contains($controlField008-24,'n')">
427                                         <genre authority="marcgt">survey of literature</genre>
428                                 </xsl:when>
429                                 <xsl:when test="contains($controlField008-24,'o')">
430                                         <genre authority="marcgt">review</genre>
431                                 </xsl:when>
432                                 <xsl:when test="contains($controlField008-24,'p')">
433                                         <genre authority="marcgt">programmed text</genre>
434                                 </xsl:when>
435                                 <xsl:when test="contains($controlField008-24,'q')">
436                                         <genre authority="marcgt">filmography</genre>
437                                 </xsl:when>
438                                 <xsl:when test="contains($controlField008-24,'r')">
439                                         <genre authority="marcgt">directory</genre>
440                                 </xsl:when>
441                                 <xsl:when test="contains($controlField008-24,'s')">
442                                         <genre authority="marcgt">statistics</genre>
443                                 </xsl:when>
444                                 <xsl:when test="contains($controlField008-24,'t')">
445                                         <genre authority="marcgt">technical report</genre>
446                                 </xsl:when>
447                                 <xsl:when test="contains($controlField008-24,'v')">
448                                         <genre authority="marcgt">legal case and case notes</genre>
449                                 </xsl:when>
450                                 <xsl:when test="contains($controlField008-24,'w')">
451                                         <genre authority="marcgt">law report or digest</genre>
452                                 </xsl:when>
453                                 <xsl:when test="contains($controlField008-24,'z')">
454                                         <genre authority="marcgt">treaty</genre>
455                                 </xsl:when>
456                         </xsl:choose>
457                         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
458                         <xsl:choose>
459                                 <xsl:when test="$controlField008-29='1'">
460                                         <genre authority="marcgt">conference publication</genre>
461                                 </xsl:when>
462                         </xsl:choose>
463                 </xsl:if>
464                 <xsl:if test="$typeOf008='CF'">
465                         <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
466                         <xsl:choose>
467                                 <xsl:when test="$controlField008-26='a'">
468                                         <genre authority="marcgt">numeric data</genre>
469                                 </xsl:when>
470                                 <xsl:when test="$controlField008-26='e'">
471                                         <genre authority="marcgt">database</genre>
472                                 </xsl:when>
473                                 <xsl:when test="$controlField008-26='f'">
474                                         <genre authority="marcgt">font</genre>
475                                 </xsl:when>
476                                 <xsl:when test="$controlField008-26='g'">
477                                         <genre authority="marcgt">game</genre>
478                                 </xsl:when>
479                         </xsl:choose>
480                 </xsl:if>
481                 <xsl:if test="$typeOf008='BK'">
482                         <xsl:if test="substring($controlField008,25,1)='j'">
483                                 <genre authority="marcgt">patent</genre>
484                         </xsl:if>
485                         <xsl:if test="substring($controlField008,25,1)='2'">
486                                 <genre authority="marcgt">offprint</genre>
487                         </xsl:if>
488                         <xsl:if test="substring($controlField008,31,1)='1'">
489                                 <genre authority="marcgt">festschrift</genre>
490                         </xsl:if>
491                         <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
492                         <xsl:if
493                                 test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
494                                 <genre authority="marcgt">biography</genre>
495                         </xsl:if>
496                         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
497                         <xsl:choose>
498                                 <xsl:when test="$controlField008-33='e'">
499                                         <genre authority="marcgt">essay</genre>
500                                 </xsl:when>
501                                 <xsl:when test="$controlField008-33='d'">
502                                         <genre authority="marcgt">drama</genre>
503                                 </xsl:when>
504                                 <xsl:when test="$controlField008-33='c'">
505                                         <genre authority="marcgt">comic strip</genre>
506                                 </xsl:when>
507                                 <xsl:when test="$controlField008-33='l'">
508                                         <genre authority="marcgt">fiction</genre>
509                                 </xsl:when>
510                                 <xsl:when test="$controlField008-33='h'">
511                                         <genre authority="marcgt">humor, satire</genre>
512                                 </xsl:when>
513                                 <xsl:when test="$controlField008-33='i'">
514                                         <genre authority="marcgt">letter</genre>
515                                 </xsl:when>
516                                 <xsl:when test="$controlField008-33='f'">
517                                         <genre authority="marcgt">novel</genre>
518                                 </xsl:when>
519                                 <xsl:when test="$controlField008-33='j'">
520                                         <genre authority="marcgt">short story</genre>
521                                 </xsl:when>
522                                 <xsl:when test="$controlField008-33='s'">
523                                         <genre authority="marcgt">speech</genre>
524                                 </xsl:when>
525                         </xsl:choose>
526                 </xsl:if>
527                 <xsl:if test="$typeOf008='MU'">
528                         <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
529                         <xsl:if test="contains($controlField008-30-31,'b')">
530                                 <genre authority="marcgt">biography</genre>
531                         </xsl:if>
532                         <xsl:if test="contains($controlField008-30-31,'c')">
533                                 <genre authority="marcgt">conference publication</genre>
534                         </xsl:if>
535                         <xsl:if test="contains($controlField008-30-31,'d')">
536                                 <genre authority="marcgt">drama</genre>
537                         </xsl:if>
538                         <xsl:if test="contains($controlField008-30-31,'e')">
539                                 <genre authority="marcgt">essay</genre>
540                         </xsl:if>
541                         <xsl:if test="contains($controlField008-30-31,'f')">
542                                 <genre authority="marcgt">fiction</genre>
543                         </xsl:if>
544                         <xsl:if test="contains($controlField008-30-31,'o')">
545                                 <genre authority="marcgt">folktale</genre>
546                         </xsl:if>
547                         <xsl:if test="contains($controlField008-30-31,'h')">
548                                 <genre authority="marcgt">history</genre>
549                         </xsl:if>
550                         <xsl:if test="contains($controlField008-30-31,'k')">
551                                 <genre authority="marcgt">humor, satire</genre>
552                         </xsl:if>
553                         <xsl:if test="contains($controlField008-30-31,'m')">
554                                 <genre authority="marcgt">memoir</genre>
555                         </xsl:if>
556                         <xsl:if test="contains($controlField008-30-31,'p')">
557                                 <genre authority="marcgt">poetry</genre>
558                         </xsl:if>
559                         <xsl:if test="contains($controlField008-30-31,'r')">
560                                 <genre authority="marcgt">rehearsal</genre>
561                         </xsl:if>
562                         <xsl:if test="contains($controlField008-30-31,'g')">
563                                 <genre authority="marcgt">reporting</genre>
564                         </xsl:if>
565                         <xsl:if test="contains($controlField008-30-31,'s')">
566                                 <genre authority="marcgt">sound</genre>
567                         </xsl:if>
568                         <xsl:if test="contains($controlField008-30-31,'l')">
569                                 <genre authority="marcgt">speech</genre>
570                         </xsl:if>
571                 </xsl:if>
572                 <xsl:if test="$typeOf008='VM'">
573                         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
574                         <xsl:choose>
575                                 <xsl:when test="$controlField008-33='a'">
576                                         <genre authority="marcgt">art original</genre>
577                                 </xsl:when>
578                                 <xsl:when test="$controlField008-33='b'">
579                                         <genre authority="marcgt">kit</genre>
580                                 </xsl:when>
581                                 <xsl:when test="$controlField008-33='c'">
582                                         <genre authority="marcgt">art reproduction</genre>
583                                 </xsl:when>
584                                 <xsl:when test="$controlField008-33='d'">
585                                         <genre authority="marcgt">diorama</genre>
586                                 </xsl:when>
587                                 <xsl:when test="$controlField008-33='f'">
588                                         <genre authority="marcgt">filmstrip</genre>
589                                 </xsl:when>
590                                 <xsl:when test="$controlField008-33='g'">
591                                         <genre authority="marcgt">legal article</genre>
592                                 </xsl:when>
593                                 <xsl:when test="$controlField008-33='i'">
594                                         <genre authority="marcgt">picture</genre>
595                                 </xsl:when>
596                                 <xsl:when test="$controlField008-33='k'">
597                                         <genre authority="marcgt">graphic</genre>
598                                 </xsl:when>
599                                 <xsl:when test="$controlField008-33='l'">
600                                         <genre authority="marcgt">technical drawing</genre>
601                                 </xsl:when>
602                                 <xsl:when test="$controlField008-33='m'">
603                                         <genre authority="marcgt">motion picture</genre>
604                                 </xsl:when>
605                                 <xsl:when test="$controlField008-33='n'">
606                                         <genre authority="marcgt">chart</genre>
607                                 </xsl:when>
608                                 <xsl:when test="$controlField008-33='o'">
609                                         <genre authority="marcgt">flash card</genre>
610                                 </xsl:when>
611                                 <xsl:when test="$controlField008-33='p'">
612                                         <genre authority="marcgt">microscope slide</genre>
613                                 </xsl:when>
614                                 <xsl:when
615                                         test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
616                                         <genre authority="marcgt">model</genre>
617                                 </xsl:when>
618                                 <xsl:when test="$controlField008-33='r'">
619                                         <genre authority="marcgt">realia</genre>
620                                 </xsl:when>
621                                 <xsl:when test="$controlField008-33='s'">
622                                         <genre authority="marcgt">slide</genre>
623                                 </xsl:when>
624                                 <xsl:when test="$controlField008-33='t'">
625                                         <genre authority="marcgt">transparency</genre>
626                                 </xsl:when>
627                                 <xsl:when test="$controlField008-33='v'">
628                                         <genre authority="marcgt">videorecording</genre>
629                                 </xsl:when>
630                                 <xsl:when test="$controlField008-33='w'">
631                                         <genre authority="marcgt">toy</genre>
632                                 </xsl:when>
633                         </xsl:choose>
634                 </xsl:if>
635
636                 <!-- 1.20 047 genre tmee-->
637
638                 <xsl:for-each select="marc:datafield[@tag=047]">
639                         <genre authority="marcgt">
640                                 <xsl:attribute name="authority">
641                                         <xsl:value-of select="marc:subfield[@code='2']"/>
642                                 </xsl:attribute>
643                                 <xsl:call-template name="subfieldSelect">
644                                         <xsl:with-param name="codes">abcdef</xsl:with-param>
645                                         <xsl:with-param name="delimeter">-</xsl:with-param>
646                                 </xsl:call-template>
647                         </genre>
648                 </xsl:for-each>
649                 <xsl:for-each select="marc:datafield[@tag=655]">
650                         <genre authority="marcgt">
651                                 <xsl:attribute name="authority">
652                                         <xsl:value-of select="marc:subfield[@code='2']"/>
653                                 </xsl:attribute>
654                                 <xsl:call-template name="subfieldSelect">
655                                         <xsl:with-param name="codes">abvxyz</xsl:with-param>
656                                         <xsl:with-param name="delimeter">-</xsl:with-param>
657                                 </xsl:call-template>
658                         </genre>
659                 </xsl:for-each>
660                 <originInfo>
661                         <xsl:variable name="MARCpublicationCode"
662                                 select="normalize-space(substring($controlField008,16,3))"/>
663                         <xsl:if test="translate($MARCpublicationCode,'|','')">
664                                 <place>
665                                         <placeTerm>
666                                                 <xsl:attribute name="type">code</xsl:attribute>
667                                                 <xsl:attribute name="authority">marccountry</xsl:attribute>
668                                                 <xsl:value-of select="$MARCpublicationCode"/>
669                                         </placeTerm>
670                                 </place>
671                         </xsl:if>
672                         <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
673                                 <place>
674                                         <placeTerm>
675                                                 <xsl:attribute name="type">code</xsl:attribute>
676                                                 <xsl:attribute name="authority">iso3166</xsl:attribute>
677                                                 <xsl:value-of select="."/>
678                                         </placeTerm>
679                                 </place>
680                         </xsl:for-each>
681                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
682                                 <place>
683                                         <placeTerm>
684                                                 <xsl:attribute name="type">text</xsl:attribute>
685                                                 <xsl:call-template name="chopPunctuationFront">
686                                                         <xsl:with-param name="chopString">
687                                                                 <xsl:call-template name="chopPunctuation">
688                                                                         <xsl:with-param name="chopString" select="."/>
689                                                                 </xsl:call-template>
690                                                         </xsl:with-param>
691                                                 </xsl:call-template>
692                                         </placeTerm>
693                                 </place>
694                         </xsl:for-each>
695                         <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
696                                 <dateValid point="start">
697                                         <xsl:value-of select="."/>
698                                 </dateValid>
699                         </xsl:for-each>
700                         <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
701                                 <dateValid point="end">
702                                         <xsl:value-of select="."/>
703                                 </dateValid>
704                         </xsl:for-each>
705                         <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
706                                 <dateModified>
707                                         <xsl:value-of select="."/>
708                                 </dateModified>
709                         </xsl:for-each>
710                         <xsl:for-each
711                                 select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
712                                 <xsl:choose>
713                                         <xsl:when test="@code='b'">
714                                                 <publisher>
715                                                         <xsl:call-template name="chopPunctuation">
716                                                                 <xsl:with-param name="chopString" select="."/>
717                                                                 <xsl:with-param name="punctuation">
718                                                                         <xsl:text>:,;/ </xsl:text>
719                                                                 </xsl:with-param>
720                                                         </xsl:call-template>
721                                                 </publisher>
722                                         </xsl:when>
723                                         <xsl:when test="@code='c'">
724                                                 <dateIssued>
725                                                         <xsl:call-template name="chopPunctuation">
726                                                                 <xsl:with-param name="chopString" select="."/>
727                                                         </xsl:call-template>
728                                                 </dateIssued>
729                                         </xsl:when>
730                                         <xsl:when test="@code='g'">
731                                                 <dateCreated>
732                                                         <xsl:value-of select="."/>
733                                                 </dateCreated>
734                                         </xsl:when>
735                                 </xsl:choose>
736                         </xsl:for-each>
737                         <xsl:variable name="dataField260c">
738                                 <xsl:call-template name="chopPunctuation">
739                                         <xsl:with-param name="chopString"
740                                                 select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/>
741                                 </xsl:call-template>
742                         </xsl:variable>
743                         <xsl:variable name="controlField008-7-10"
744                                 select="normalize-space(substring($controlField008, 8, 4))"/>
745                         <xsl:variable name="controlField008-11-14"
746                                 select="normalize-space(substring($controlField008, 12, 4))"/>
747                         <xsl:variable name="controlField008-6"
748                                 select="normalize-space(substring($controlField008, 7, 1))"/>
749                         <xsl:if
750                                 test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
751                                 <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
752                                         <dateIssued encoding="marc">
753                                                 <xsl:value-of select="$controlField008-7-10"/>
754                                         </dateIssued>
755                                 </xsl:if>
756                         </xsl:if>
757                         <xsl:if
758                                 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'">
759                                 <xsl:if test="$controlField008-7-10">
760                                         <dateIssued encoding="marc" point="start">
761                                                 <xsl:value-of select="$controlField008-7-10"/>
762                                         </dateIssued>
763                                 </xsl:if>
764                         </xsl:if>
765                         <xsl:if
766                                 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'">
767                                 <xsl:if test="$controlField008-11-14">
768                                         <dateIssued encoding="marc" point="end">
769                                                 <xsl:value-of select="$controlField008-11-14"/>
770                                         </dateIssued>
771                                 </xsl:if>
772                         </xsl:if>
773                         <xsl:if test="$controlField008-6='q'">
774                                 <xsl:if test="$controlField008-7-10">
775                                         <dateIssued encoding="marc" point="start" qualifier="questionable">
776                                                 <xsl:value-of select="$controlField008-7-10"/>
777                                         </dateIssued>
778                                 </xsl:if>
779                         </xsl:if>
780                         <xsl:if test="$controlField008-6='q'">
781                                 <xsl:if test="$controlField008-11-14">
782                                         <dateIssued encoding="marc" point="end" qualifier="questionable">
783                                                 <xsl:value-of select="$controlField008-11-14"/>
784                                         </dateIssued>
785                                 </xsl:if>
786                         </xsl:if>
787                         <xsl:if test="$controlField008-6='t'">
788                                 <xsl:if test="$controlField008-11-14">
789                                         <copyrightDate encoding="marc">
790                                                 <xsl:value-of select="$controlField008-11-14"/>
791                                         </copyrightDate>
792                                 </xsl:if>
793                         </xsl:if>
794                         <xsl:for-each
795                                 select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
796                                 <dateCaptured encoding="iso8601">
797                                         <xsl:value-of select="."/>
798                                 </dateCaptured>
799                         </xsl:for-each>
800                         <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
801                                 <dateCaptured encoding="iso8601" point="start">
802                                         <xsl:value-of select="."/>
803                                 </dateCaptured>
804                         </xsl:for-each>
805                         <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
806                                 <dateCaptured encoding="iso8601" point="end">
807                                         <xsl:value-of select="."/>
808                                 </dateCaptured>
809                         </xsl:for-each>
810                         <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
811                                 <edition>
812                                         <xsl:value-of select="."/>
813                                 </edition>
814                         </xsl:for-each>
815                         <xsl:for-each select="marc:leader">
816                                 <issuance>
817                                         <xsl:choose>
818                                                 <xsl:when
819                                                         test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'"
820                                                         >monographic</xsl:when>
821                                                 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'"
822                                                 >continuing</xsl:when>
823                                         </xsl:choose>
824                                 </issuance>
825                         </xsl:for-each>
826                         <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
827                                 <frequency>
828                                         <xsl:call-template name="subfieldSelect">
829                                                 <xsl:with-param name="codes">ab</xsl:with-param>
830                                         </xsl:call-template>
831                                 </frequency>
832                         </xsl:for-each>
833                 </originInfo>
834                 <xsl:variable name="controlField008-35-37"
835                         select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>
836                 <xsl:if test="$controlField008-35-37">
837                         <language>
838                                 <languageTerm authority="iso639-2b" type="code">
839                                         <xsl:value-of select="substring($controlField008,36,3)"/>
840                                 </languageTerm>
841                         </language>
842                 </xsl:if>
843                 <xsl:for-each select="marc:datafield[@tag=041]">
844                         <xsl:for-each
845                                 select="marc:subfield[@code='a' or @code='b' or @code='d' or @code='e' or @code='f' or @code='g' or @code='h']">
846                                 <xsl:variable name="langCodes" select="."/>
847                                 <xsl:choose>
848                                         <xsl:when test="../marc:subfield[@code='2']='rfc3066'">
849                                                 <!-- not stacked but could be repeated -->
850                                                 <xsl:call-template name="rfcLanguages">
851                                                         <xsl:with-param name="nodeNum">
852                                                                 <xsl:value-of select="1"/>
853                                                         </xsl:with-param>
854                                                         <xsl:with-param name="usedLanguages">
855                                                                 <xsl:text/>
856                                                         </xsl:with-param>
857                                                         <xsl:with-param name="controlField008-35-37">
858                                                                 <xsl:value-of select="$controlField008-35-37"/>
859                                                         </xsl:with-param>
860                                                 </xsl:call-template>
861                                         </xsl:when>
862                                         <xsl:otherwise>
863                                                 <!-- iso -->
864                                                 <xsl:variable name="allLanguages">
865                                                         <xsl:copy-of select="$langCodes"/>
866                                                 </xsl:variable>
867                                                 <xsl:variable name="currentLanguage">
868                                                         <xsl:value-of select="substring($allLanguages,1,3)"/>
869                                                 </xsl:variable>
870                                                 <xsl:call-template name="isoLanguage">
871                                                         <xsl:with-param name="currentLanguage">
872                                                                 <xsl:value-of select="substring($allLanguages,1,3)"/>
873                                                         </xsl:with-param>
874                                                         <xsl:with-param name="remainingLanguages">
875                                                                 <xsl:value-of
876                                                                         select="substring($allLanguages,4,string-length($allLanguages)-3)"
877                                                                 />
878                                                         </xsl:with-param>
879                                                         <xsl:with-param name="usedLanguages">
880                                                                 <xsl:if test="$controlField008-35-37">
881                                                                         <xsl:value-of select="$controlField008-35-37"/>
882                                                                 </xsl:if>
883                                                         </xsl:with-param>
884                                                 </xsl:call-template>
885                                         </xsl:otherwise>
886                                 </xsl:choose>
887                         </xsl:for-each>
888                 </xsl:for-each>
889                 <xsl:variable name="physicalDescription">
890                         <!--3.2 change tmee 007/11 -->
891                         <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
892                                 <digitalOrigin>reformatted digital</digitalOrigin>
893                         </xsl:if>
894                         <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
895                                 <digitalOrigin>digitized microfilm</digitalOrigin>
896                         </xsl:if>
897                         <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
898                                 <digitalOrigin>digitized other analog</digitalOrigin>
899                         </xsl:if>
900                         <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
901                         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
902                         <xsl:variable name="check008-23">
903                                 <xsl:if
904                                         test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
905                                         <xsl:value-of select="true()"/>
906                                 </xsl:if>
907                         </xsl:variable>
908                         <xsl:variable name="check008-29">
909                                 <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
910                                         <xsl:value-of select="true()"/>
911                                 </xsl:if>
912                         </xsl:variable>
913                         <xsl:choose>
914                                 <xsl:when
915                                         test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
916                                         <form authority="marcform">braille</form>
917                                 </xsl:when>
918                                 <xsl:when
919                                         test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
920                                         <form authority="marcform">print</form>
921                                 </xsl:when>
922                                 <xsl:when
923                                         test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
924                                         <form authority="marcform">electronic</form>
925                                 </xsl:when>
926                                 <xsl:when
927                                         test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
928                                         <form authority="marcform">microfiche</form>
929                                 </xsl:when>
930                                 <xsl:when
931                                         test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
932                                         <form authority="marcform">microfilm</form>
933                                 </xsl:when>
934                         </xsl:choose>
935                         <!-- 1/04 fix -->
936                         <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
937                                 <form authority="gmd">
938                                         <xsl:call-template name="chopBrackets">
939                                                 <xsl:with-param name="chopString">
940                                                         <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"
941                                                         />
942                                                 </xsl:with-param>
943                                         </xsl:call-template>
944                                 </form>
945                         </xsl:if>
946                         <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
947                                 <form authority="gmd">
948                                         <xsl:call-template name="chopBrackets">
949                                                 <xsl:with-param name="chopString">
950                                                         <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"
951                                                         />
952                                                 </xsl:with-param>
953                                         </xsl:call-template>
954                                 </form>
955                         </xsl:if>
956                         <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
957                                 <form authority="gmd">
958                                         <xsl:call-template name="chopBrackets">
959                                                 <xsl:with-param name="chopString">
960                                                         <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"
961                                                         />
962                                                 </xsl:with-param>
963                                         </xsl:call-template>
964                                 </form>
965                         </xsl:if>
966                         <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
967                                 <form authority="gmd">
968                                         <xsl:call-template name="chopBrackets">
969                                                 <xsl:with-param name="chopString">
970                                                         <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"
971                                                         />
972                                                 </xsl:with-param>
973                                         </xsl:call-template>
974                                 </form>
975                         </xsl:if>
976                         <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
977                                 <form authority="gmd">
978                                         <xsl:call-template name="chopBrackets">
979                                                 <xsl:with-param name="chopString">
980                                                         <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"
981                                                         />
982                                                 </xsl:with-param>
983                                         </xsl:call-template>
984                                 </form>
985                         </xsl:if>
986                         <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
987                                 <form authority="gmd">
988                                         <xsl:call-template name="chopBrackets">
989                                                 <xsl:with-param name="chopString">
990                                                         <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"
991                                                         />
992                                                 </xsl:with-param>
993                                         </xsl:call-template>
994                                 </form>
995                         </xsl:if>
996                         <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
997                                 <form>
998                                         <xsl:value-of select="."/>
999                                 </form>
1000                         </xsl:for-each>
1001                         <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
1002                                 <xsl:choose>
1003                                         <xsl:when test="substring(text(),14,1)='a'">
1004                                                 <reformattingQuality>access</reformattingQuality>
1005                                         </xsl:when>
1006                                         <xsl:when test="substring(text(),14,1)='p'">
1007                                                 <reformattingQuality>preservation</reformattingQuality>
1008                                         </xsl:when>
1009                                         <xsl:when test="substring(text(),14,1)='r'">
1010                                                 <reformattingQuality>replacement</reformattingQuality>
1011                                         </xsl:when>
1012                                 </xsl:choose>
1013                         </xsl:for-each>
1014                         <!--3.2 change tmee 007/01 -->
1015                         <xsl:if
1016                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
1017                                 <form authority="smd">chip cartridge</form>
1018                         </xsl:if>
1019                         <xsl:if
1020                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
1021                                 <form authority="smd">computer optical disc cartridge</form>
1022                         </xsl:if>
1023                         <xsl:if
1024                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
1025                                 <form authority="smd">magnetic disc</form>
1026                         </xsl:if>
1027                         <xsl:if
1028                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
1029                                 <form authority="smd">magneto-optical disc</form>
1030                         </xsl:if>
1031                         <xsl:if
1032                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
1033                                 <form authority="smd">optical disc</form>
1034                         </xsl:if>
1035                         <xsl:if
1036                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
1037                                 <form authority="smd">remote</form>
1038                         </xsl:if>
1039                         <xsl:if
1040                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
1041                                 <form authority="smd">tape cartridge</form>
1042                         </xsl:if>
1043                         <xsl:if
1044                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
1045                                 <form authority="smd">tape cassette</form>
1046                         </xsl:if>
1047                         <xsl:if
1048                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
1049                                 <form authority="smd">tape reel</form>
1050                         </xsl:if>
1051
1052                         <xsl:if
1053                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
1054                                 <form authority="smd">celestial globe</form>
1055                         </xsl:if>
1056                         <xsl:if
1057                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
1058                                 <form authority="smd">earth moon globe</form>
1059                         </xsl:if>
1060                         <xsl:if
1061                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
1062                                 <form authority="smd">planetary or lunar globe</form>
1063                         </xsl:if>
1064                         <xsl:if
1065                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
1066                                 <form authority="smd">terrestrial globe</form>
1067                         </xsl:if>
1068
1069                         <xsl:if
1070                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
1071                                 <form authority="smd">kit</form>
1072                         </xsl:if>
1073
1074                         <xsl:if
1075                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
1076                                 <form authority="smd">atlas</form>
1077                         </xsl:if>
1078                         <xsl:if
1079                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
1080                                 <form authority="smd">diagram</form>
1081                         </xsl:if>
1082                         <xsl:if
1083                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
1084                                 <form authority="smd">map</form>
1085                         </xsl:if>
1086                         <xsl:if
1087                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
1088                                 <form authority="smd">model</form>
1089                         </xsl:if>
1090                         <xsl:if
1091                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
1092                                 <form authority="smd">profile</form>
1093                         </xsl:if>
1094                         <xsl:if
1095                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
1096                                 <form authority="smd">remote-sensing image</form>
1097                         </xsl:if>
1098                         <xsl:if
1099                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
1100                                 <form authority="smd">section</form>
1101                         </xsl:if>
1102                         <xsl:if
1103                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
1104                                 <form authority="smd">view</form>
1105                         </xsl:if>
1106
1107                         <xsl:if
1108                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
1109                                 <form authority="smd">aperture card</form>
1110                         </xsl:if>
1111                         <xsl:if
1112                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
1113                                 <form authority="smd">microfiche</form>
1114                         </xsl:if>
1115                         <xsl:if
1116                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
1117                                 <form authority="smd">microfiche cassette</form>
1118                         </xsl:if>
1119                         <xsl:if
1120                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
1121                                 <form authority="smd">microfilm cartridge</form>
1122                         </xsl:if>
1123                         <xsl:if
1124                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
1125                                 <form authority="smd">microfilm cassette</form>
1126                         </xsl:if>
1127                         <xsl:if
1128                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
1129                                 <form authority="smd">microfilm reel</form>
1130                         </xsl:if>
1131                         <xsl:if
1132                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
1133                                 <form authority="smd">microopaque</form>
1134                         </xsl:if>
1135
1136                         <xsl:if
1137                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
1138                                 <form authority="smd">film cartridge</form>
1139                         </xsl:if>
1140                         <xsl:if
1141                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
1142                                 <form authority="smd">film cassette</form>
1143                         </xsl:if>
1144                         <xsl:if
1145                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
1146                                 <form authority="smd">film reel</form>
1147                         </xsl:if>
1148
1149                         <xsl:if
1150                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
1151                                 <form authority="smd">chart</form>
1152                         </xsl:if>
1153                         <xsl:if
1154                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
1155                                 <form authority="smd">collage</form>
1156                         </xsl:if>
1157                         <xsl:if
1158                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
1159                                 <form authority="smd">drawing</form>
1160                         </xsl:if>
1161                         <xsl:if
1162                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
1163                                 <form authority="smd">flash card</form>
1164                         </xsl:if>
1165                         <xsl:if
1166                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
1167                                 <form authority="smd">painting</form>
1168                         </xsl:if>
1169                         <xsl:if
1170                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
1171                                 <form authority="smd">photomechanical print</form>
1172                         </xsl:if>
1173                         <xsl:if
1174                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
1175                                 <form authority="smd">photonegative</form>
1176                         </xsl:if>
1177                         <xsl:if
1178                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
1179                                 <form authority="smd">photoprint</form>
1180                         </xsl:if>
1181                         <xsl:if
1182                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
1183                                 <form authority="smd">picture</form>
1184                         </xsl:if>
1185                         <xsl:if
1186                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
1187                                 <form authority="smd">print</form>
1188                         </xsl:if>
1189                         <xsl:if
1190                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
1191                                 <form authority="smd">technical drawing</form>
1192                         </xsl:if>
1193
1194                         <xsl:if
1195                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
1196                                 <form authority="smd">notated music</form>
1197                         </xsl:if>
1198
1199                         <xsl:if
1200                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
1201                                 <form authority="smd">filmslip</form>
1202                         </xsl:if>
1203                         <xsl:if
1204                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
1205                                 <form authority="smd">filmstrip cartridge</form>
1206                         </xsl:if>
1207                         <xsl:if
1208                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
1209                                 <form authority="smd">filmstrip roll</form>
1210                         </xsl:if>
1211                         <xsl:if
1212                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
1213                                 <form authority="smd">other filmstrip type</form>
1214                         </xsl:if>
1215                         <xsl:if
1216                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
1217                                 <form authority="smd">slide</form>
1218                         </xsl:if>
1219                         <xsl:if
1220                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
1221                                 <form authority="smd">transparency</form>
1222                         </xsl:if>
1223                         <xsl:if
1224                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
1225                                 <form authority="smd">remote-sensing image</form>
1226                         </xsl:if>
1227                         <xsl:if
1228                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
1229                                 <form authority="smd">cylinder</form>
1230                         </xsl:if>
1231                         <xsl:if
1232                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
1233                                 <form authority="smd">roll</form>
1234                         </xsl:if>
1235                         <xsl:if
1236                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
1237                                 <form authority="smd">sound cartridge</form>
1238                         </xsl:if>
1239                         <xsl:if
1240                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
1241                                 <form authority="smd">sound cassette</form>
1242                         </xsl:if>
1243                         <xsl:if
1244                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
1245                                 <form authority="smd">sound disc</form>
1246                         </xsl:if>
1247                         <xsl:if
1248                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
1249                                 <form authority="smd">sound-tape reel</form>
1250                         </xsl:if>
1251                         <xsl:if
1252                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
1253                                 <form authority="smd">sound-track film</form>
1254                         </xsl:if>
1255                         <xsl:if
1256                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
1257                                 <form authority="smd">wire recording</form>
1258                         </xsl:if>
1259
1260                         <xsl:if
1261                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
1262                                 <form authority="smd">braille</form>
1263                         </xsl:if>
1264                         <xsl:if
1265                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
1266                                 <form authority="smd">combination</form>
1267                         </xsl:if>
1268                         <xsl:if
1269                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
1270                                 <form authority="smd">moon</form>
1271                         </xsl:if>
1272                         <xsl:if
1273                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
1274                                 <form authority="smd">tactile, with no writing system</form>
1275                         </xsl:if>
1276
1277                         <xsl:if
1278                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
1279                                 <form authority="smd">braille</form>
1280                         </xsl:if>
1281                         <xsl:if
1282                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
1283                                 <form authority="smd">large print</form>
1284                         </xsl:if>
1285                         <xsl:if
1286                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
1287                                 <form authority="smd">regular print</form>
1288                         </xsl:if>
1289                         <xsl:if
1290                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
1291                                 <form authority="smd">text in looseleaf binder</form>
1292                         </xsl:if>
1293
1294                         <xsl:if
1295                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
1296                                 <form authority="smd">videocartridge</form>
1297                         </xsl:if>
1298                         <xsl:if
1299                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
1300                                 <form authority="smd">videocassette</form>
1301                         </xsl:if>
1302                         <xsl:if
1303                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
1304                                 <form authority="smd">videodisc</form>
1305                         </xsl:if>
1306                         <xsl:if
1307                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
1308                                 <form authority="smd">videoreel</form>
1309                         </xsl:if>
1310
1311                         <xsl:for-each
1312                                 select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)&gt;1]">
1313                                 <internetMediaType>
1314                                         <xsl:value-of select="."/>
1315                                 </internetMediaType>
1316                         </xsl:for-each>
1317                         <xsl:for-each select="marc:datafield[@tag=300]">
1318                                 <extent>
1319                                         <xsl:call-template name="subfieldSelect">
1320                                                 <xsl:with-param name="codes">abce</xsl:with-param>
1321                                         </xsl:call-template>
1322                                 </extent>
1323                         </xsl:for-each>
1324                 </xsl:variable>
1325                 <xsl:if test="string-length(normalize-space($physicalDescription))">
1326                         <physicalDescription>
1327                                 <xsl:copy-of select="$physicalDescription"/>
1328                         </physicalDescription>
1329                 </xsl:if>
1330                 <xsl:for-each select="marc:datafield[@tag=520]">
1331                         <abstract>
1332                                 <xsl:call-template name="uri"/>
1333                                 <xsl:call-template name="subfieldSelect">
1334                                         <xsl:with-param name="codes">ab</xsl:with-param>
1335                                 </xsl:call-template>
1336                         </abstract>
1337                 </xsl:for-each>
1338                 <xsl:for-each select="marc:datafield[@tag=505]">
1339                         <tableOfContents>
1340                                 <xsl:call-template name="uri"/>
1341                                 <xsl:call-template name="subfieldSelect">
1342                                         <xsl:with-param name="codes">agrt</xsl:with-param>
1343                                 </xsl:call-template>
1344                         </tableOfContents>
1345                 </xsl:for-each>
1346                 <xsl:for-each select="marc:datafield[@tag=521]">
1347                         <targetAudience>
1348                                 <xsl:call-template name="subfieldSelect">
1349                                         <xsl:with-param name="codes">ab</xsl:with-param>
1350                                 </xsl:call-template>
1351                         </targetAudience>
1352                 </xsl:for-each>
1353                 <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
1354                         <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
1355                         <xsl:choose>
1356                                 <!-- 01/04 fix -->
1357                                 <xsl:when test="$controlField008-22='d'">
1358                                         <targetAudience authority="marctarget">adolescent</targetAudience>
1359                                 </xsl:when>
1360                                 <xsl:when test="$controlField008-22='e'">
1361                                         <targetAudience authority="marctarget">adult</targetAudience>
1362                                 </xsl:when>
1363                                 <xsl:when test="$controlField008-22='g'">
1364                                         <targetAudience authority="marctarget">general</targetAudience>
1365                                 </xsl:when>
1366                                 <xsl:when
1367                                         test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
1368                                         <targetAudience authority="marctarget">juvenile</targetAudience>
1369                                 </xsl:when>
1370                                 <xsl:when test="$controlField008-22='a'">
1371                                         <targetAudience authority="marctarget">preschool</targetAudience>
1372                                 </xsl:when>
1373                                 <xsl:when test="$controlField008-22='f'">
1374                                         <targetAudience authority="marctarget">specialized</targetAudience>
1375                                 </xsl:when>
1376                         </xsl:choose>
1377                 </xsl:if>
1378                 <xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
1379                         <note type="statement of responsibility">
1380                                 <xsl:value-of select="."/>
1381                         </note>
1382                 </xsl:for-each>
1383                 <xsl:for-each select="marc:datafield[@tag=500]">
1384                         <note>
1385                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1386                                 <xsl:call-template name="uri"/>
1387                         </note>
1388                 </xsl:for-each>
1389
1390                 <!--3.2 change tmee additional note fields-->
1391
1392                 <xsl:for-each select="marc:datafield[@tag=506]">
1393                         <note type="restrictions">
1394                                 <xsl:call-template name="uri"/>
1395                                 <xsl:variable name="str">
1396                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1397                                                 <xsl:value-of select="."/>
1398                                                 <xsl:text> </xsl:text>
1399                                         </xsl:for-each>
1400                                 </xsl:variable>
1401                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1402                         </note>
1403                 </xsl:for-each>
1404
1405                 <xsl:for-each select="marc:datafield[@tag=510]">
1406                         <note type="citation/reference">
1407                                 <xsl:call-template name="uri"/>
1408                                 <xsl:variable name="str">
1409                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1410                                                 <xsl:value-of select="."/>
1411                                                 <xsl:text> </xsl:text>
1412                                         </xsl:for-each>
1413                                 </xsl:variable>
1414                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1415                         </note>
1416                 </xsl:for-each>
1417
1418
1419                 <xsl:for-each select="marc:datafield[@tag=511]">
1420                         <note type="performers">
1421                                 <xsl:call-template name="uri"/>
1422                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1423                         </note>
1424                 </xsl:for-each>
1425                 <xsl:for-each select="marc:datafield[@tag=518]">
1426                         <note type="venue">
1427                                 <xsl:call-template name="uri"/>
1428                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1429                         </note>
1430                 </xsl:for-each>
1431
1432                 <xsl:for-each select="marc:datafield[@tag=530]">
1433                         <note type="additional physical form">
1434                                 <xsl:call-template name="uri"/>
1435                                 <xsl:variable name="str">
1436                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1437                                                 <xsl:value-of select="."/>
1438                                                 <xsl:text> </xsl:text>
1439                                         </xsl:for-each>
1440                                 </xsl:variable>
1441                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1442                         </note>
1443                 </xsl:for-each>
1444
1445                 <xsl:for-each select="marc:datafield[@tag=533]">
1446                         <note type="reproduction">
1447                                 <xsl:call-template name="uri"/>
1448                                 <xsl:variable name="str">
1449                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1450                                                 <xsl:value-of select="."/>
1451                                                 <xsl:text> </xsl:text>
1452                                         </xsl:for-each>
1453                                 </xsl:variable>
1454                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1455                         </note>
1456                 </xsl:for-each>
1457
1458                 <xsl:for-each select="marc:datafield[@tag=534]">
1459                         <note type="original version">
1460                                 <xsl:call-template name="uri"/>
1461                                 <xsl:variable name="str">
1462                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1463                                                 <xsl:value-of select="."/>
1464                                                 <xsl:text> </xsl:text>
1465                                         </xsl:for-each>
1466                                 </xsl:variable>
1467                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1468                         </note>
1469                 </xsl:for-each>
1470
1471                 <xsl:for-each select="marc:datafield[@tag=538]">
1472                         <note type="system details">
1473                                 <xsl:call-template name="uri"/>
1474                                 <xsl:variable name="str">
1475                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1476                                                 <xsl:value-of select="."/>
1477                                                 <xsl:text> </xsl:text>
1478                                         </xsl:for-each>
1479                                 </xsl:variable>
1480                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1481                         </note>
1482                 </xsl:for-each>
1483
1484                 <xsl:for-each select="marc:datafield[@tag=583]">
1485                         <note type="action">
1486                                 <xsl:call-template name="uri"/>
1487                                 <xsl:variable name="str">
1488                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1489                                                 <xsl:value-of select="."/>
1490                                                 <xsl:text> </xsl:text>
1491                                         </xsl:for-each>
1492                                 </xsl:variable>
1493                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1494                         </note>
1495                 </xsl:for-each>
1496
1497                 <xsl:for-each
1498                         select="marc:datafield[@tag=501 or @tag=502 or @tag=504 or @tag=507 or @tag=508 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=535 or @tag=536 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=584 or @tag=585 or @tag=586]">
1499                         <note>
1500                                 <xsl:call-template name="uri"/>
1501                                 <xsl:variable name="str">
1502                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1503                                                 <xsl:value-of select="."/>
1504                                                 <xsl:text> </xsl:text>
1505                                         </xsl:for-each>
1506                                 </xsl:variable>
1507                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1508                         </note>
1509                 </xsl:for-each>
1510                 <xsl:for-each
1511                         select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
1512                         <subject>
1513                                 <cartographics>
1514                                         <coordinates>
1515                                                 <xsl:call-template name="subfieldSelect">
1516                                                         <xsl:with-param name="codes">defg</xsl:with-param>
1517                                                 </xsl:call-template>
1518                                         </coordinates>
1519                                 </cartographics>
1520                         </subject>
1521                 </xsl:for-each>
1522                 <xsl:for-each select="marc:datafield[@tag=043]">
1523                         <subject>
1524                                 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1525                                         <geographicCode>
1526                                                 <xsl:attribute name="authority">
1527                                                         <xsl:if test="@code='a'">
1528                                                                 <xsl:text>marcgac</xsl:text>
1529                                                         </xsl:if>
1530                                                         <xsl:if test="@code='b'">
1531                                                                 <xsl:value-of select="following-sibling::marc:subfield[@code=2]"/>
1532                                                         </xsl:if>
1533                                                         <xsl:if test="@code='c'">
1534                                                                 <xsl:text>iso3166</xsl:text>
1535                                                         </xsl:if>
1536                                                 </xsl:attribute>
1537                                                 <xsl:value-of select="self::marc:subfield"/>
1538                                         </geographicCode>
1539                                 </xsl:for-each>
1540                         </subject>
1541                 </xsl:for-each>
1542                 <!-- tmee 2006/11/27 -->
1543                 <xsl:for-each select="marc:datafield[@tag=255]">
1544                         <subject>
1545                                 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1546                                         <cartographics>
1547                                                 <xsl:if test="@code='a'">
1548                                                         <scale>
1549                                                                 <xsl:value-of select="."/>
1550                                                         </scale>
1551                                                 </xsl:if>
1552                                                 <xsl:if test="@code='b'">
1553                                                         <projection>
1554                                                                 <xsl:value-of select="."/>
1555                                                         </projection>
1556                                                 </xsl:if>
1557                                                 <xsl:if test="@code='c'">
1558                                                         <coordinates>
1559                                                                 <xsl:value-of select="."/>
1560                                                         </coordinates>
1561                                                 </xsl:if>
1562                                         </cartographics>
1563                                 </xsl:for-each>
1564                         </subject>
1565                 </xsl:for-each>
1566
1567                 <xsl:apply-templates select="marc:datafield[653 &gt;= @tag and @tag &gt;= 600]"/>
1568                 <xsl:apply-templates select="marc:datafield[@tag=656]"/>
1569                 <xsl:for-each select="marc:datafield[@tag=752 or @tag=662]">
1570                         <subject>
1571                                 <hierarchicalGeographic>
1572                                         <xsl:for-each select="marc:subfield[@code='a']">
1573                                                 <country>
1574                                                         <xsl:call-template name="chopPunctuation">
1575                                                                 <xsl:with-param name="chopString" select="."/>
1576                                                         </xsl:call-template>
1577                                                 </country>
1578                                         </xsl:for-each>
1579                                         <xsl:for-each select="marc:subfield[@code='b']">
1580                                                 <state>
1581                                                         <xsl:call-template name="chopPunctuation">
1582                                                                 <xsl:with-param name="chopString" select="."/>
1583                                                         </xsl:call-template>
1584                                                 </state>
1585                                         </xsl:for-each>
1586                                         <xsl:for-each select="marc:subfield[@code='c']">
1587                                                 <county>
1588                                                         <xsl:call-template name="chopPunctuation">
1589                                                                 <xsl:with-param name="chopString" select="."/>
1590                                                         </xsl:call-template>
1591                                                 </county>
1592                                         </xsl:for-each>
1593                                         <xsl:for-each select="marc:subfield[@code='d']">
1594                                                 <city>
1595                                                         <xsl:call-template name="chopPunctuation">
1596                                                                 <xsl:with-param name="chopString" select="."/>
1597                                                         </xsl:call-template>
1598                                                 </city>
1599                                         </xsl:for-each>
1600                                         <xsl:for-each select="marc:subfield[@code='e']">
1601                                                 <citySection>
1602                                                         <xsl:call-template name="chopPunctuation">
1603                                                                 <xsl:with-param name="chopString" select="."/>
1604                                                         </xsl:call-template>
1605                                                 </citySection>
1606                                         </xsl:for-each>
1607                                         <xsl:for-each select="marc:subfield[@code='g']">
1608                                                 <region>
1609                                                         <xsl:call-template name="chopPunctuation">
1610                                                                 <xsl:with-param name="chopString" select="."/>
1611                                                         </xsl:call-template>
1612                                                 </region>
1613                                         </xsl:for-each>
1614                                         <xsl:for-each select="marc:subfield[@code='h']">
1615                                                 <extraterrestrialArea>
1616                                                         <xsl:call-template name="chopPunctuation">
1617                                                                 <xsl:with-param name="chopString" select="."/>
1618                                                         </xsl:call-template>
1619                                                 </extraterrestrialArea>
1620                                         </xsl:for-each>
1621                                 </hierarchicalGeographic>
1622                         </subject>
1623                 </xsl:for-each>
1624                 <xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
1625                         <subject>
1626                                 <xsl:choose>
1627                                         <xsl:when test="@ind1=2">
1628                                                 <temporal encoding="iso8601" point="start">
1629                                                         <xsl:call-template name="chopPunctuation">
1630                                                                 <xsl:with-param name="chopString">
1631                                                                         <xsl:value-of select="marc:subfield[@code='b'][1]"/>
1632                                                                 </xsl:with-param>
1633                                                         </xsl:call-template>
1634                                                 </temporal>
1635                                                 <temporal encoding="iso8601" point="end">
1636                                                         <xsl:call-template name="chopPunctuation">
1637                                                                 <xsl:with-param name="chopString">
1638                                                                         <xsl:value-of select="marc:subfield[@code='b'][2]"/>
1639                                                                 </xsl:with-param>
1640                                                         </xsl:call-template>
1641                                                 </temporal>
1642                                         </xsl:when>
1643                                         <xsl:otherwise>
1644                                                 <xsl:for-each select="marc:subfield[@code='b']">
1645                                                         <temporal encoding="iso8601">
1646                                                                 <xsl:call-template name="chopPunctuation">
1647                                                                         <xsl:with-param name="chopString" select="."/>
1648                                                                 </xsl:call-template>
1649                                                         </temporal>
1650                                                 </xsl:for-each>
1651                                         </xsl:otherwise>
1652                                 </xsl:choose>
1653                         </subject>
1654                 </xsl:for-each>
1655                 <xsl:for-each select="marc:datafield[@tag=050]">
1656                         <xsl:for-each select="marc:subfield[@code='b']">
1657                                 <classification authority="lcc">
1658                                         <xsl:if test="../marc:subfield[@code='3']">
1659                                                 <xsl:attribute name="displayLabel">
1660                                                         <xsl:value-of select="../marc:subfield[@code='3']"/>
1661                                                 </xsl:attribute>
1662                                         </xsl:if>
1663                                         <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
1664                                         <xsl:text> </xsl:text>
1665                                         <xsl:value-of select="text()"/>
1666                                 </classification>
1667                         </xsl:for-each>
1668                         <xsl:for-each
1669                                 select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
1670                                 <classification authority="lcc">
1671                                         <xsl:if test="../marc:subfield[@code='3']">
1672                                                 <xsl:attribute name="displayLabel">
1673                                                         <xsl:value-of select="../marc:subfield[@code='3']"/>
1674                                                 </xsl:attribute>
1675                                         </xsl:if>
1676                                         <xsl:value-of select="text()"/>
1677                                 </classification>
1678                         </xsl:for-each>
1679                 </xsl:for-each>
1680                 <xsl:for-each select="marc:datafield[@tag=082]">
1681                         <classification authority="ddc">
1682                                 <xsl:if test="marc:subfield[@code='2']">
1683                                         <xsl:attribute name="edition">
1684                                                 <xsl:value-of select="marc:subfield[@code='2']"/>
1685                                         </xsl:attribute>
1686                                 </xsl:if>
1687                                 <xsl:call-template name="subfieldSelect">
1688                                         <xsl:with-param name="codes">ab</xsl:with-param>
1689                                 </xsl:call-template>
1690                         </classification>
1691                 </xsl:for-each>
1692                 <xsl:for-each select="marc:datafield[@tag=080]">
1693                         <classification authority="udc">
1694                                 <xsl:call-template name="subfieldSelect">
1695                                         <xsl:with-param name="codes">abx</xsl:with-param>
1696                                 </xsl:call-template>
1697                         </classification>
1698                 </xsl:for-each>
1699                 <xsl:for-each select="marc:datafield[@tag=060]">
1700                         <classification authority="nlm">
1701                                 <xsl:call-template name="subfieldSelect">
1702                                         <xsl:with-param name="codes">ab</xsl:with-param>
1703                                 </xsl:call-template>
1704                         </classification>
1705                 </xsl:for-each>
1706                 <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
1707                         <classification authority="sudocs">
1708                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1709                         </classification>
1710                 </xsl:for-each>
1711                 <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
1712                         <classification authority="candoc">
1713                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1714                         </classification>
1715                 </xsl:for-each>
1716                 <xsl:for-each select="marc:datafield[@tag=086]">
1717                         <classification>
1718                                 <xsl:attribute name="authority">
1719                                         <xsl:value-of select="marc:subfield[@code='2']"/>
1720                                 </xsl:attribute>
1721                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1722                         </classification>
1723                 </xsl:for-each>
1724                 <xsl:for-each select="marc:datafield[@tag=084]">
1725                         <classification>
1726                                 <xsl:attribute name="authority">
1727                                         <xsl:value-of select="marc:subfield[@code='2']"/>
1728                                 </xsl:attribute>
1729                                 <xsl:call-template name="subfieldSelect">
1730                                         <xsl:with-param name="codes">ab</xsl:with-param>
1731                                 </xsl:call-template>
1732                         </classification>
1733                 </xsl:for-each>
1734                 <xsl:for-each select="marc:datafield[@tag=440]">
1735                         <relatedItem type="series">
1736                                 <titleInfo>
1737                                         <title>
1738                                                 <xsl:call-template name="chopPunctuation">
1739                                                         <xsl:with-param name="chopString">
1740                                                                 <xsl:call-template name="subfieldSelect">
1741                                                                         <xsl:with-param name="codes">av</xsl:with-param>
1742                                                                 </xsl:call-template>
1743                                                         </xsl:with-param>
1744                                                 </xsl:call-template>
1745                                         </title>
1746                                         <xsl:call-template name="part"/>
1747                                 </titleInfo>
1748                         </relatedItem>
1749                 </xsl:for-each>
1750                 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
1751                         <relatedItem type="series">
1752                                 <titleInfo>
1753                                         <title>
1754                                                 <xsl:call-template name="chopPunctuation">
1755                                                         <xsl:with-param name="chopString">
1756                                                                 <xsl:call-template name="subfieldSelect">
1757                                                                         <xsl:with-param name="codes">av</xsl:with-param>
1758                                                                 </xsl:call-template>
1759                                                         </xsl:with-param>
1760                                                 </xsl:call-template>
1761                                         </title>
1762                                         <xsl:call-template name="part"/>
1763                                 </titleInfo>
1764                         </relatedItem>
1765                 </xsl:for-each>
1766                 <xsl:for-each select="marc:datafield[@tag=510]">
1767                         <relatedItem type="isReferencedBy">
1768                                 <note>
1769                                         <xsl:call-template name="subfieldSelect">
1770                                                 <xsl:with-param name="codes">abcx3</xsl:with-param>
1771                                         </xsl:call-template>
1772                                 </note>
1773                         </relatedItem>
1774                 </xsl:for-each>
1775                 <xsl:for-each select="marc:datafield[@tag=534]">
1776                         <relatedItem type="original">
1777                                 <xsl:call-template name="relatedTitle"/>
1778                                 <xsl:call-template name="relatedName"/>
1779                                 <xsl:if test="marc:subfield[@code='b' or @code='c']">
1780                                         <originInfo>
1781                                                 <xsl:for-each select="marc:subfield[@code='c']">
1782                                                         <publisher>
1783                                                                 <xsl:value-of select="."/>
1784                                                         </publisher>
1785                                                 </xsl:for-each>
1786                                                 <xsl:for-each select="marc:subfield[@code='b']">
1787                                                         <edition>
1788                                                                 <xsl:value-of select="."/>
1789                                                         </edition>
1790                                                 </xsl:for-each>
1791                                         </originInfo>
1792                                 </xsl:if>
1793                                 <xsl:call-template name="relatedIdentifierISSN"/>
1794                                 <xsl:for-each select="marc:subfield[@code='z']">
1795                                         <identifier type="isbn">
1796                                                 <xsl:value-of select="."/>
1797                                         </identifier>
1798                                 </xsl:for-each>
1799                                 <xsl:call-template name="relatedNote"/>
1800                         </relatedItem>
1801                 </xsl:for-each>
1802                 <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
1803                         <relatedItem>
1804                                 <xsl:call-template name="constituentOrRelatedType"/>
1805                                 <titleInfo>
1806                                         <title>
1807                                                 <xsl:call-template name="chopPunctuation">
1808                                                         <xsl:with-param name="chopString">
1809                                                                 <xsl:call-template name="specialSubfieldSelect">
1810                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1811                                                                         <xsl:with-param name="axis">t</xsl:with-param>
1812                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
1813                                                                 </xsl:call-template>
1814                                                         </xsl:with-param>
1815                                                 </xsl:call-template>
1816                                         </title>
1817                                         <xsl:call-template name="part"/>
1818                                 </titleInfo>
1819                                 <name type="personal">
1820                                         <namePart>
1821                                                 <xsl:call-template name="specialSubfieldSelect">
1822                                                         <xsl:with-param name="anyCodes">aq</xsl:with-param>
1823                                                         <xsl:with-param name="axis">t</xsl:with-param>
1824                                                         <xsl:with-param name="beforeCodes">g</xsl:with-param>
1825                                                 </xsl:call-template>
1826                                         </namePart>
1827                                         <xsl:call-template name="termsOfAddress"/>
1828                                         <xsl:call-template name="nameDate"/>
1829                                         <xsl:call-template name="role"/>
1830                                 </name>
1831                                 <xsl:call-template name="relatedForm"/>
1832                                 <xsl:call-template name="relatedIdentifierISSN"/>
1833                         </relatedItem>
1834                 </xsl:for-each>
1835                 <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
1836                         <relatedItem>
1837                                 <xsl:call-template name="constituentOrRelatedType"/>
1838                                 <titleInfo>
1839                                         <title>
1840                                                 <xsl:call-template name="chopPunctuation">
1841                                                         <xsl:with-param name="chopString">
1842                                                                 <xsl:call-template name="specialSubfieldSelect">
1843                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1844                                                                         <xsl:with-param name="axis">t</xsl:with-param>
1845                                                                         <xsl:with-param name="afterCodes">dg</xsl:with-param>
1846                                                                 </xsl:call-template>
1847                                                         </xsl:with-param>
1848                                                 </xsl:call-template>
1849                                         </title>
1850                                         <xsl:call-template name="relatedPartNumName"/>
1851                                 </titleInfo>
1852                                 <name type="corporate">
1853                                         <xsl:for-each select="marc:subfield[@code='a']">
1854                                                 <namePart>
1855                                                         <xsl:value-of select="."/>
1856                                                 </namePart>
1857                                         </xsl:for-each>
1858                                         <xsl:for-each select="marc:subfield[@code='b']">
1859                                                 <namePart>
1860                                                         <xsl:value-of select="."/>
1861                                                 </namePart>
1862                                         </xsl:for-each>
1863                                         <xsl:variable name="tempNamePart">
1864                                                 <xsl:call-template name="specialSubfieldSelect">
1865                                                         <xsl:with-param name="anyCodes">c</xsl:with-param>
1866                                                         <xsl:with-param name="axis">t</xsl:with-param>
1867                                                         <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
1868                                                 </xsl:call-template>
1869                                         </xsl:variable>
1870                                         <xsl:if test="normalize-space($tempNamePart)">
1871                                                 <namePart>
1872                                                         <xsl:value-of select="$tempNamePart"/>
1873                                                 </namePart>
1874                                         </xsl:if>
1875                                         <xsl:call-template name="role"/>
1876                                 </name>
1877                                 <xsl:call-template name="relatedForm"/>
1878                                 <xsl:call-template name="relatedIdentifierISSN"/>
1879                         </relatedItem>
1880                 </xsl:for-each>
1881                 <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
1882                         <relatedItem>
1883                                 <xsl:call-template name="constituentOrRelatedType"/>
1884                                 <titleInfo>
1885                                         <title>
1886                                                 <xsl:call-template name="chopPunctuation">
1887                                                         <xsl:with-param name="chopString">
1888                                                                 <xsl:call-template name="specialSubfieldSelect">
1889                                                                         <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
1890                                                                         <xsl:with-param name="axis">t</xsl:with-param>
1891                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
1892                                                                 </xsl:call-template>
1893                                                         </xsl:with-param>
1894                                                 </xsl:call-template>
1895                                         </title>
1896                                         <xsl:call-template name="relatedPartNumName"/>
1897                                 </titleInfo>
1898                                 <name type="conference">
1899                                         <namePart>
1900                                                 <xsl:call-template name="specialSubfieldSelect">
1901                                                         <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
1902                                                         <xsl:with-param name="axis">t</xsl:with-param>
1903                                                         <xsl:with-param name="beforeCodes">gn</xsl:with-param>
1904                                                 </xsl:call-template>
1905                                         </namePart>
1906                                 </name>
1907                                 <xsl:call-template name="relatedForm"/>
1908                                 <xsl:call-template name="relatedIdentifierISSN"/>
1909                         </relatedItem>
1910                 </xsl:for-each>
1911                 <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
1912                         <relatedItem>
1913                                 <xsl:call-template name="constituentOrRelatedType"/>
1914                                 <titleInfo>
1915                                         <title>
1916                                                 <xsl:call-template name="chopPunctuation">
1917                                                         <xsl:with-param name="chopString">
1918                                                                 <xsl:call-template name="subfieldSelect">
1919                                                                         <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
1920                                                                 </xsl:call-template>
1921                                                         </xsl:with-param>
1922                                                 </xsl:call-template>
1923                                         </title>
1924                                         <xsl:call-template name="part"/>
1925                                 </titleInfo>
1926                                 <xsl:call-template name="relatedForm"/>
1927                                 <xsl:call-template name="relatedIdentifierISSN"/>
1928                         </relatedItem>
1929                 </xsl:for-each>
1930                 <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
1931                         <relatedItem>
1932                                 <xsl:call-template name="constituentOrRelatedType"/>
1933                                 <titleInfo>
1934                                         <title>
1935                                                 <xsl:call-template name="chopPunctuation">
1936                                                         <xsl:with-param name="chopString">
1937                                                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1938                                                         </xsl:with-param>
1939                                                 </xsl:call-template>
1940                                         </title>
1941                                         <xsl:call-template name="part"/>
1942                                 </titleInfo>
1943                                 <xsl:call-template name="relatedForm"/>
1944                         </relatedItem>
1945                 </xsl:for-each>
1946                 <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
1947                         <relatedItem type="series">
1948                                 <xsl:call-template name="relatedItem76X-78X"/>
1949                         </relatedItem>
1950                 </xsl:for-each>
1951                 <xsl:for-each
1952                         select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
1953                         <relatedItem>
1954                                 <xsl:call-template name="relatedItem76X-78X"/>
1955                         </relatedItem>
1956                 </xsl:for-each>
1957                 <xsl:for-each select="marc:datafield[@tag=775]">
1958                         <relatedItem type="otherVersion">
1959                                 <xsl:call-template name="relatedItem76X-78X"/>
1960                         </relatedItem>
1961                 </xsl:for-each>
1962                 <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
1963                         <relatedItem type="constituent">
1964                                 <xsl:call-template name="relatedItem76X-78X"/>
1965                         </relatedItem>
1966                 </xsl:for-each>
1967                 <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
1968                         <relatedItem type="host">
1969                                 <xsl:call-template name="relatedItem76X-78X"/>
1970                         </relatedItem>
1971                 </xsl:for-each>
1972                 <xsl:for-each select="marc:datafield[@tag=776]">
1973                         <relatedItem type="otherFormat">
1974                                 <xsl:call-template name="relatedItem76X-78X"/>
1975                         </relatedItem>
1976                 </xsl:for-each>
1977                 <xsl:for-each select="marc:datafield[@tag=780]">
1978                         <relatedItem type="preceding">
1979                                 <xsl:call-template name="relatedItem76X-78X"/>
1980                         </relatedItem>
1981                 </xsl:for-each>
1982                 <xsl:for-each select="marc:datafield[@tag=785]">
1983                         <relatedItem type="succeeding">
1984                                 <xsl:call-template name="relatedItem76X-78X"/>
1985                         </relatedItem>
1986                 </xsl:for-each>
1987                 <xsl:for-each select="marc:datafield[@tag=786]">
1988                         <relatedItem type="original">
1989                                 <xsl:call-template name="relatedItem76X-78X"/>
1990                         </relatedItem>
1991                 </xsl:for-each>
1992                 <xsl:for-each select="marc:datafield[@tag=800]">
1993                         <relatedItem type="series">
1994                                 <titleInfo>
1995                                         <title>
1996                                                 <xsl:call-template name="chopPunctuation">
1997                                                         <xsl:with-param name="chopString">
1998                                                                 <xsl:call-template name="specialSubfieldSelect">
1999                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2000                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2001                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
2002                                                                 </xsl:call-template>
2003                                                         </xsl:with-param>
2004                                                 </xsl:call-template>
2005                                         </title>
2006                                         <xsl:call-template name="part"/>
2007                                 </titleInfo>
2008                                 <name type="personal">
2009                                         <namePart>
2010                                                 <xsl:call-template name="chopPunctuation">
2011                                                         <xsl:with-param name="chopString">
2012                                                                 <xsl:call-template name="specialSubfieldSelect">
2013                                                                         <xsl:with-param name="anyCodes">aq</xsl:with-param>
2014                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2015                                                                         <xsl:with-param name="beforeCodes">g</xsl:with-param>
2016                                                                 </xsl:call-template>
2017                                                         </xsl:with-param>
2018                                                 </xsl:call-template>
2019                                         </namePart>
2020                                         <xsl:call-template name="termsOfAddress"/>
2021                                         <xsl:call-template name="nameDate"/>
2022                                         <xsl:call-template name="role"/>
2023                                 </name>
2024                                 <xsl:call-template name="relatedForm"/>
2025                         </relatedItem>
2026                 </xsl:for-each>
2027                 <xsl:for-each select="marc:datafield[@tag=810]">
2028                         <relatedItem type="series">
2029                                 <titleInfo>
2030                                         <title>
2031                                                 <xsl:call-template name="chopPunctuation">
2032                                                         <xsl:with-param name="chopString">
2033                                                                 <xsl:call-template name="specialSubfieldSelect">
2034                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2035                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2036                                                                         <xsl:with-param name="afterCodes">dg</xsl:with-param>
2037                                                                 </xsl:call-template>
2038                                                         </xsl:with-param>
2039                                                 </xsl:call-template>
2040                                         </title>
2041                                         <xsl:call-template name="relatedPartNumName"/>
2042                                 </titleInfo>
2043                                 <name type="corporate">
2044                                         <xsl:for-each select="marc:subfield[@code='a']">
2045                                                 <namePart>
2046                                                         <xsl:value-of select="."/>
2047                                                 </namePart>
2048                                         </xsl:for-each>
2049                                         <xsl:for-each select="marc:subfield[@code='b']">
2050                                                 <namePart>
2051                                                         <xsl:value-of select="."/>
2052                                                 </namePart>
2053                                         </xsl:for-each>
2054                                         <namePart>
2055                                                 <xsl:call-template name="specialSubfieldSelect">
2056                                                         <xsl:with-param name="anyCodes">c</xsl:with-param>
2057                                                         <xsl:with-param name="axis">t</xsl:with-param>
2058                                                         <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
2059                                                 </xsl:call-template>
2060                                         </namePart>
2061                                         <xsl:call-template name="role"/>
2062                                 </name>
2063                                 <xsl:call-template name="relatedForm"/>
2064                         </relatedItem>
2065                 </xsl:for-each>
2066                 <xsl:for-each select="marc:datafield[@tag=811]">
2067                         <relatedItem type="series">
2068                                 <titleInfo>
2069                                         <title>
2070                                                 <xsl:call-template name="chopPunctuation">
2071                                                         <xsl:with-param name="chopString">
2072                                                                 <xsl:call-template name="specialSubfieldSelect">
2073                                                                         <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
2074                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2075                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
2076                                                                 </xsl:call-template>
2077                                                         </xsl:with-param>
2078                                                 </xsl:call-template>
2079                                         </title>
2080                                         <xsl:call-template name="relatedPartNumName"/>
2081                                 </titleInfo>
2082                                 <name type="conference">
2083                                         <namePart>
2084                                                 <xsl:call-template name="specialSubfieldSelect">
2085                                                         <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
2086                                                         <xsl:with-param name="axis">t</xsl:with-param>
2087                                                         <xsl:with-param name="beforeCodes">gn</xsl:with-param>
2088                                                 </xsl:call-template>
2089                                         </namePart>
2090                                         <xsl:call-template name="role"/>
2091                                 </name>
2092                                 <xsl:call-template name="relatedForm"/>
2093                         </relatedItem>
2094                 </xsl:for-each>
2095                 <xsl:for-each select="marc:datafield[@tag='830']">
2096                         <relatedItem type="series">
2097                                 <titleInfo>
2098                                         <title>
2099                                                 <xsl:call-template name="chopPunctuation">
2100                                                         <xsl:with-param name="chopString">
2101                                                                 <xsl:call-template name="subfieldSelect">
2102                                                                         <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
2103                                                                 </xsl:call-template>
2104                                                         </xsl:with-param>
2105                                                 </xsl:call-template>
2106                                         </title>
2107                                         <xsl:call-template name="part"/>
2108                                 </titleInfo>
2109                                 <xsl:call-template name="relatedForm"/>
2110                         </relatedItem>
2111                 </xsl:for-each>
2112                 <xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']">
2113                         <relatedItem>
2114                                 <internetMediaType>
2115                                         <xsl:value-of select="."/>
2116                                 </internetMediaType>
2117                         </relatedItem>
2118                 </xsl:for-each>
2119                 <xsl:for-each select="marc:datafield[@tag='020']">
2120                         <xsl:call-template name="isInvalid">
2121                                 <xsl:with-param name="type">isbn</xsl:with-param>
2122                         </xsl:call-template>
2123                         <xsl:if test="marc:subfield[@code='a']">
2124                                 <identifier type="isbn">
2125                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2126                                 </identifier>
2127                         </xsl:if>
2128                 </xsl:for-each>
2129                 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']">
2130                         <xsl:call-template name="isInvalid">
2131                                 <xsl:with-param name="type">isrc</xsl:with-param>
2132                         </xsl:call-template>
2133                         <xsl:if test="marc:subfield[@code='a']">
2134                                 <identifier type="isrc">
2135                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2136                                 </identifier>
2137                         </xsl:if>
2138                 </xsl:for-each>
2139                 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']">
2140                         <xsl:call-template name="isInvalid">
2141                                 <xsl:with-param name="type">ismn</xsl:with-param>
2142                         </xsl:call-template>
2143                         <xsl:if test="marc:subfield[@code='a']">
2144                                 <identifier type="ismn">
2145                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2146                                 </identifier>
2147                         </xsl:if>
2148                 </xsl:for-each>
2149                 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']">
2150                         <xsl:call-template name="isInvalid">
2151                                 <xsl:with-param name="type">sici</xsl:with-param>
2152                         </xsl:call-template>
2153                         <identifier type="sici">
2154                                 <xsl:call-template name="subfieldSelect">
2155                                         <xsl:with-param name="codes">ab</xsl:with-param>
2156                                 </xsl:call-template>
2157                         </identifier>
2158                 </xsl:for-each>