]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/954.data.MODS33-xsl.sql
LP#1772955: Only include xacts with balance in summary
[Evergreen.git] / Open-ILS / src / sql / Pg / 954.data.MODS33-xsl.sql
1 UPDATE config.xml_transform SET xslt=$$<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:output encoding="UTF-8" indent="yes" method="xml"/>
5
6         <xsl:variable name="ascii">
7                 <xsl:text> !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text>
8         </xsl:variable>
9
10         <xsl:variable name="latin1">
11                 <xsl:text> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text>
12         </xsl:variable>
13         <!-- Characters that usually don't need to be escaped -->
14         <xsl:variable name="safe">
15                 <xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text>
16         </xsl:variable>
17
18         <xsl:variable name="hex">0123456789ABCDEF</xsl:variable>
19
20     <!-- Evergreen specific: revert Revision 1.23, so we can have those authority xlink attributes back. -->
21
22         <!--MARC21slim2MODS3-3.xsl
23 Revision 1.27 - Mapped 648 to <subject> 2009/03/13 tmee
24 Revision 1.26 - Added subfield $s mapping for 130/240/730  2008/10/16 tmee
25 Revision 1.25 - Mapped 040e to <descriptiveStandard> and Leader/18 to <descriptive standard>aacr2  2008/09/18 tmee
26 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
27 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
28 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
29 Revision 1.21 - Mapped 856 ind2=1 or ind2=2 to <relatedItem><location><url>  2008/07/03  tmee
30 Revision 1.20 - Added genre w/@auth="contents of 2" and type= "musical composition"  2008/07/01  tmee
31 Revision 1.19 - Added genre offprint for 008/24+ BK code 2  2008/07/01  tmee
32 Revision 1.18 - Added xlink/uri for subfield 0 for 130/240/730, 100/700, 110/710, 111/711  2008/06/26  tmee
33 Revision 1.17 - Added mapping of 662 2008/05/14 tmee    
34 Revision 1.16 - Changed @authority from "marc" to "marcgt" for 007 and 008 codes mapped to a term in <genre> 2007/07/10  tmee
35 Revision 1.15 - For field 630, moved call to part template outside title element  2007/07/10  tmee
36 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
37 Revision 1.13 - Changed order of output under cartographics to reflect schema  2006/11/28  tmee
38 Revision 1.12 - Updated to reflect MODS 3.2 Mapping  2006/10/11  tmee
39 Revision 1.11 - The attribute objectPart moved from <languageTerm> to <language>  2006/04/08  jrad
40 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
41 Revision 1.9 - Subfield $y was added to field 242 2004/09/02 10:57 jrad
42 Revision 1.8 - Subject chopPunctuation expanded and attribute fixes 2004/08/12 jrad
43 Revision 1.7 - 2004/03/25 08:29 jrad
44 Revision 1.6 - Various validation fixes 2004/02/20 ntra
45 Revision 1.5 - MODS2 to MODS3 updates, language unstacking and de-duping, chopPunctuation expanded  2003/10/02 16:18:58  ntra
46 Revision 1.3 - Additional Changes not related to MODS Version 2.0 by ntra
47 Revision 1.2 - Added Log Comment  2003/03/24 19:37:42  ckeith
48 -->
49         <xsl:template match="/">
50                 <xsl:choose>
51                         <xsl:when test="//marc:collection">
52                                 <modsCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
53                                         xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
54                                         <xsl:for-each select="//marc:collection/marc:record">
55                                                 <mods version="3.3">
56                                                         <xsl:call-template name="marcRecord"/>
57                                                 </mods>
58                                         </xsl:for-each>
59                                 </modsCollection>
60                         </xsl:when>
61                         <xsl:otherwise>
62                                 <mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3"
63                                         xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
64                                         <xsl:for-each select="//marc:record">
65                                                 <xsl:call-template name="marcRecord"/>
66                                         </xsl:for-each>
67                                 </mods>
68                         </xsl:otherwise>
69                 </xsl:choose>
70         </xsl:template>
71         <xsl:template name="marcRecord">
72                 <xsl:variable name="leader" select="marc:leader"/>
73                 <xsl:variable name="leader6" select="substring($leader,7,1)"/>
74                 <xsl:variable name="leader7" select="substring($leader,8,1)"/>
75                 <xsl:variable name="controlField008" select="marc:controlfield[@tag='008']"/>
76                 <xsl:variable name="typeOf008">
77                         <xsl:choose>
78                                 <xsl:when test="$leader6='a'">
79                                         <xsl:choose>
80                                                 <xsl:when
81                                                         test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'">BK</xsl:when>
82                                                 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'">SE</xsl:when>
83                                         </xsl:choose>
84                                 </xsl:when>
85                                 <xsl:when test="$leader6='t'">BK</xsl:when>
86                                 <xsl:when test="$leader6='p'">MM</xsl:when>
87                                 <xsl:when test="$leader6='m'">CF</xsl:when>
88                                 <xsl:when test="$leader6='e' or $leader6='f'">MP</xsl:when>
89                                 <xsl:when test="$leader6='g' or $leader6='k' or $leader6='o' or $leader6='r'">VM</xsl:when>
90                                 <xsl:when test="$leader6='c' or $leader6='d' or $leader6='i' or $leader6='j'"
91                                 >MU</xsl:when>
92                         </xsl:choose>
93                 </xsl:variable>
94                 <xsl:for-each select="marc:datafield[@tag='245']">
95                         <titleInfo>
96                                 <xsl:variable name="title">
97                                         <xsl:choose>
98                                                 <xsl:when test="marc:subfield[@code='b']">
99                                                         <xsl:call-template name="specialSubfieldSelect">
100                                                                 <xsl:with-param name="axis">b</xsl:with-param>
101                                                                 <xsl:with-param name="beforeCodes">afgk</xsl:with-param>
102                                                         </xsl:call-template>
103                                                 </xsl:when>
104                                                 <xsl:otherwise>
105                                                         <xsl:call-template name="subfieldSelect">
106                                                                 <xsl:with-param name="codes">abfgk</xsl:with-param>
107                                                         </xsl:call-template>
108                                                 </xsl:otherwise>
109                                         </xsl:choose>
110                                 </xsl:variable>
111                                 <xsl:variable name="titleChop">
112                                         <xsl:call-template name="chopPunctuation">
113                                                 <xsl:with-param name="chopString">
114                                                         <xsl:value-of select="$title"/>
115                                                 </xsl:with-param>
116                         <xsl:with-param name="punctuation">
117                           <xsl:text>,;/ </xsl:text>
118                         </xsl:with-param>
119                                         </xsl:call-template>
120                                 </xsl:variable>
121                                 <xsl:choose>
122                                         <xsl:when test="@ind2&gt;0">
123                                                 <nonSort>
124                                                         <xsl:value-of select="substring($titleChop,1,@ind2)"/>
125                                                 </nonSort>
126                                                 <title>
127                                                         <xsl:value-of select="substring($titleChop,@ind2+1)"/>
128                                                 </title>
129                                         </xsl:when>
130                                         <xsl:otherwise>
131                                                 <title>
132                                                         <xsl:value-of select="$titleChop"/>
133                                                 </title>
134                                         </xsl:otherwise>
135                                 </xsl:choose>
136                                 <xsl:if test="marc:subfield[@code='b']">
137                                         <subTitle>
138                                                 <xsl:call-template name="chopPunctuation">
139                                                         <xsl:with-param name="chopString">
140                                                                 <xsl:call-template name="specialSubfieldSelect">
141                                                                         <xsl:with-param name="axis">b</xsl:with-param>
142                                                                         <xsl:with-param name="anyCodes">b</xsl:with-param>
143                                                                         <xsl:with-param name="afterCodes">afgk</xsl:with-param>
144                                                                 </xsl:call-template>
145                                                         </xsl:with-param>
146                                                 </xsl:call-template>
147                                         </subTitle>
148                                 </xsl:if>
149                                 <xsl:call-template name="part"/>
150                         </titleInfo>
151                 </xsl:for-each>
152                 <xsl:for-each select="marc:datafield[@tag='210']">
153                         <titleInfo type="abbreviated">
154                                 <title>
155                                         <xsl:call-template name="chopPunctuation">
156                                                 <xsl:with-param name="chopString">
157                                                         <xsl:call-template name="subfieldSelect">
158                                                                 <xsl:with-param name="codes">a</xsl:with-param>
159                                                         </xsl:call-template>
160                                                 </xsl:with-param>
161                                         </xsl:call-template>
162                                 </title>
163                                 <xsl:call-template name="subtitle"/>
164                         </titleInfo>
165                 </xsl:for-each>
166                 <xsl:for-each select="marc:datafield[@tag='242']">
167                         <titleInfo type="translated">
168                                 <!--09/01/04 Added subfield $y-->
169                                 <xsl:for-each select="marc:subfield[@code='y']">
170                                         <xsl:attribute name="lang">
171                                                 <xsl:value-of select="text()"/>
172                                         </xsl:attribute>
173                                 </xsl:for-each>
174                                 <xsl:for-each select="marc:subfield[@code='i']">
175                                         <xsl:attribute name="displayLabel">
176                                                 <xsl:value-of select="text()"/>
177                                         </xsl:attribute>
178                                 </xsl:for-each>
179                                 <title>
180                                         <xsl:call-template name="chopPunctuation">
181                                                 <xsl:with-param name="chopString">
182                                                         <xsl:call-template name="subfieldSelect">
183                                                                 <!-- 1/04 removed $h, b -->
184                                                                 <xsl:with-param name="codes">a</xsl:with-param>
185                                                         </xsl:call-template>
186                                                 </xsl:with-param>
187                                         </xsl:call-template>
188                                 </title>
189                                 <!-- 1/04 fix -->
190                                 <xsl:call-template name="subtitle"/>
191                                 <xsl:call-template name="part"/>
192                         </titleInfo>
193                 </xsl:for-each>
194                 <xsl:for-each select="marc:datafield[@tag='246']">
195                         <titleInfo type="alternative">
196                                 <xsl:for-each select="marc:subfield[@code='i']">
197                                         <xsl:attribute name="displayLabel">
198                                                 <xsl:value-of select="text()"/>
199                                         </xsl:attribute>
200                                 </xsl:for-each>
201                                 <title>
202                                         <xsl:call-template name="chopPunctuation">
203                                                 <xsl:with-param name="chopString">
204                                                         <xsl:call-template name="subfieldSelect">
205                                                                 <!-- 1/04 removed $h, $b -->
206                                                                 <xsl:with-param name="codes">af</xsl:with-param>
207                                                         </xsl:call-template>
208                                                 </xsl:with-param>
209                                         </xsl:call-template>
210                                 </title>
211                                 <xsl:call-template name="subtitle"/>
212                                 <xsl:call-template name="part"/>
213                         </titleInfo>
214                 </xsl:for-each>
215                 <xsl:for-each
216                         select="marc:datafield[@tag='130']|marc:datafield[@tag='240']|marc:datafield[@tag='730'][@ind2!='2']">
217                         <titleInfo type="uniform">
218                                 <title>
219                                                 <xsl:call-template name="uri"/>
220
221                                         <xsl:variable name="str">
222                                                 <xsl:for-each select="marc:subfield">
223                                                         <xsl:if
224                                                                 test="(contains('adfklmors',@code) and (not(../marc:subfield[@code='n' or @code='p']) or (following-sibling::marc:subfield[@code='n' or @code='p'])))">
225                                                                 <xsl:value-of select="text()"/>
226                                                                 <xsl:text> </xsl:text>
227                                                         </xsl:if>
228                                                 </xsl:for-each>
229                                         </xsl:variable>
230                                         <xsl:call-template name="chopPunctuation">
231                                                 <xsl:with-param name="chopString">
232                                                         <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
233                                                 </xsl:with-param>
234                                         </xsl:call-template>
235                                 </title>
236                                 <xsl:call-template name="part"/>
237                         </titleInfo>
238                 </xsl:for-each>
239                 <xsl:for-each select="marc:datafield[@tag='740'][@ind2!='2']">
240                         <titleInfo type="alternative">
241                                 <title>
242                                         <xsl:call-template name="chopPunctuation">
243                                                 <xsl:with-param name="chopString">
244                                                         <xsl:call-template name="subfieldSelect">
245                                                                 <xsl:with-param name="codes">ah</xsl:with-param>
246                                                         </xsl:call-template>
247                                                 </xsl:with-param>
248                                         </xsl:call-template>
249                                 </title>
250                                 <xsl:call-template name="part"/>
251                         </titleInfo>
252                 </xsl:for-each>
253                 <xsl:for-each select="marc:datafield[@tag='100']">
254                         <name type="personal">
255
256                                 <xsl:call-template name="uri"/>
257
258                                 <xsl:call-template name="nameABCDQ"/>
259                                 <xsl:call-template name="affiliation"/>
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='110']">
267                         <name type="corporate">
268
269                                         <xsl:call-template name="uri"/>
270
271                                 <xsl:call-template name="nameABCDN"/>
272                                 <role>
273                                         <roleTerm authority="marcrelator" type="text">creator</roleTerm>
274                                 </role>
275                                 <xsl:call-template name="role"/>
276                         </name>
277                 </xsl:for-each>
278                 <xsl:for-each select="marc:datafield[@tag='111']">
279                         <name type="conference">
280
281                                         <xsl:call-template name="uri"/>
282
283                                 <xsl:call-template name="nameACDEQ"/>
284                                 <role>
285                                         <roleTerm authority="marcrelator" type="text">creator</roleTerm>
286                                 </role>
287                                 <xsl:call-template name="role"/>
288                         </name>
289                 </xsl:for-each>
290                 <xsl:for-each select="marc:datafield[@tag='700'][not(marc:subfield[@code='t'])]">
291                         <name type="personal">
292
293                                         <xsl:call-template name="uri"/>
294
295                                 <xsl:call-template name="nameABCDQ"/>
296                                 <xsl:call-template name="affiliation"/>
297                                 <xsl:call-template name="role"/>
298                         </name>
299                 </xsl:for-each>
300                 <xsl:for-each select="marc:datafield[@tag='710'][not(marc:subfield[@code='t'])]">
301                         <name type="corporate">
302
303                                         <xsl:call-template name="uri"/>
304
305                                 <xsl:call-template name="nameABCDN"/>
306                                 <xsl:call-template name="role"/>
307                         </name>
308                 </xsl:for-each>
309                 <xsl:for-each select="marc:datafield[@tag='711'][not(marc:subfield[@code='t'])]">
310                         <name type="conference">
311
312                                         <xsl:call-template name="uri"/>
313
314                                 <xsl:call-template name="nameACDEQ"/>
315                                 <xsl:call-template name="role"/>
316                         </name>
317                 </xsl:for-each>
318                 <xsl:for-each select="marc:datafield[@tag='720'][not(marc:subfield[@code='t'])]">
319                         <name>
320                                 <xsl:if test="@ind1=1">
321                                         <xsl:attribute name="type">
322                                                 <xsl:text>personal</xsl:text>
323                                         </xsl:attribute>
324                                 </xsl:if>
325                                 <namePart>
326                                         <xsl:value-of select="marc:subfield[@code='a']"/>
327                                 </namePart>
328                                 <xsl:call-template name="role"/>
329                         </name>
330                 </xsl:for-each>
331                 <typeOfResource>
332                         <xsl:if test="$leader7='c'">
333                                 <xsl:attribute name="collection">yes</xsl:attribute>
334                         </xsl:if>
335                         <xsl:if test="$leader6='d' or $leader6='f' or $leader6='p' or $leader6='t'">
336                                 <xsl:attribute name="manuscript">yes</xsl:attribute>
337                         </xsl:if>
338                         <xsl:choose>
339                                 <xsl:when test="$leader6='a' or $leader6='t'">text</xsl:when>
340                                 <xsl:when test="$leader6='e' or $leader6='f'">cartographic</xsl:when>
341                                 <xsl:when test="$leader6='c' or $leader6='d'">notated music</xsl:when>
342                                 <xsl:when test="$leader6='i'">sound recording-nonmusical</xsl:when>
343                                 <xsl:when test="$leader6='j'">sound recording-musical</xsl:when>
344                                 <xsl:when test="$leader6='k'">still image</xsl:when>
345                                 <xsl:when test="$leader6='g'">moving image</xsl:when>
346                                 <xsl:when test="$leader6='r'">three dimensional object</xsl:when>
347                                 <xsl:when test="$leader6='m'">software, multimedia</xsl:when>
348                                 <xsl:when test="$leader6='p'">mixed material</xsl:when>
349                         </xsl:choose>
350                 </typeOfResource>
351                 <xsl:if test="substring($controlField008,26,1)='d'">
352                         <genre authority="marcgt">globe</genre>
353                 </xsl:if>
354                 <xsl:if
355                         test="marc:controlfield[@tag='007'][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
356                         <genre authority="marcgt">remote-sensing image</genre>
357                 </xsl:if>
358                 <xsl:if test="$typeOf008='MP'">
359                         <xsl:variable name="controlField008-25" select="substring($controlField008,26,1)"/>
360                         <xsl:choose>
361                                 <xsl:when
362                                         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']">
363                                         <genre authority="marcgt">map</genre>
364                                 </xsl:when>
365                                 <xsl:when
366                                         test="$controlField008-25='e' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
367                                         <genre authority="marcgt">atlas</genre>
368                                 </xsl:when>
369                         </xsl:choose>
370                 </xsl:if>
371                 <xsl:if test="$typeOf008='SE'">
372                         <xsl:variable name="controlField008-21" select="substring($controlField008,22,1)"/>
373                         <xsl:choose>
374                                 <xsl:when test="$controlField008-21='d'">
375                                         <genre authority="marcgt">database</genre>
376                                 </xsl:when>
377                                 <xsl:when test="$controlField008-21='l'">
378                                         <genre authority="marcgt">loose-leaf</genre>
379                                 </xsl:when>
380                                 <xsl:when test="$controlField008-21='m'">
381                                         <genre authority="marcgt">series</genre>
382                                 </xsl:when>
383                                 <xsl:when test="$controlField008-21='n'">
384                                         <genre authority="marcgt">newspaper</genre>
385                                 </xsl:when>
386                                 <xsl:when test="$controlField008-21='p'">
387                                         <genre authority="marcgt">periodical</genre>
388                                 </xsl:when>
389                                 <xsl:when test="$controlField008-21='w'">
390                                         <genre authority="marcgt">web site</genre>
391                                 </xsl:when>
392                         </xsl:choose>
393                 </xsl:if>
394                 <xsl:if test="$typeOf008='BK' or $typeOf008='SE'">
395                         <xsl:variable name="controlField008-24" select="substring($controlField008,25,4)"/>
396                         <xsl:choose>
397                                 <xsl:when test="contains($controlField008-24,'a')">
398                                         <genre authority="marcgt">abstract or summary</genre>
399                                 </xsl:when>
400                                 <xsl:when test="contains($controlField008-24,'b')">
401                                         <genre authority="marcgt">bibliography</genre>
402                                 </xsl:when>
403                                 <xsl:when test="contains($controlField008-24,'c')">
404                                         <genre authority="marcgt">catalog</genre>
405                                 </xsl:when>
406                                 <xsl:when test="contains($controlField008-24,'d')">
407                                         <genre authority="marcgt">dictionary</genre>
408                                 </xsl:when>
409                                 <xsl:when test="contains($controlField008-24,'e')">
410                                         <genre authority="marcgt">encyclopedia</genre>
411                                 </xsl:when>
412                                 <xsl:when test="contains($controlField008-24,'f')">
413                                         <genre authority="marcgt">handbook</genre>
414                                 </xsl:when>
415                                 <xsl:when test="contains($controlField008-24,'g')">
416                                         <genre authority="marcgt">legal article</genre>
417                                 </xsl:when>
418                                 <xsl:when test="contains($controlField008-24,'i')">
419                                         <genre authority="marcgt">index</genre>
420                                 </xsl:when>
421                                 <xsl:when test="contains($controlField008-24,'k')">
422                                         <genre authority="marcgt">discography</genre>
423                                 </xsl:when>
424                                 <xsl:when test="contains($controlField008-24,'l')">
425                                         <genre authority="marcgt">legislation</genre>
426                                 </xsl:when>
427                                 <xsl:when test="contains($controlField008-24,'m')">
428                                         <genre authority="marcgt">theses</genre>
429                                 </xsl:when>
430                                 <xsl:when test="contains($controlField008-24,'n')">
431                                         <genre authority="marcgt">survey of literature</genre>
432                                 </xsl:when>
433                                 <xsl:when test="contains($controlField008-24,'o')">
434                                         <genre authority="marcgt">review</genre>
435                                 </xsl:when>
436                                 <xsl:when test="contains($controlField008-24,'p')">
437                                         <genre authority="marcgt">programmed text</genre>
438                                 </xsl:when>
439                                 <xsl:when test="contains($controlField008-24,'q')">
440                                         <genre authority="marcgt">filmography</genre>
441                                 </xsl:when>
442                                 <xsl:when test="contains($controlField008-24,'r')">
443                                         <genre authority="marcgt">directory</genre>
444                                 </xsl:when>
445                                 <xsl:when test="contains($controlField008-24,'s')">
446                                         <genre authority="marcgt">statistics</genre>
447                                 </xsl:when>
448                                 <xsl:when test="contains($controlField008-24,'t')">
449                                         <genre authority="marcgt">technical report</genre>
450                                 </xsl:when>
451                                 <xsl:when test="contains($controlField008-24,'v')">
452                                         <genre authority="marcgt">legal case and case notes</genre>
453                                 </xsl:when>
454                                 <xsl:when test="contains($controlField008-24,'w')">
455                                         <genre authority="marcgt">law report or digest</genre>
456                                 </xsl:when>
457                                 <xsl:when test="contains($controlField008-24,'z')">
458                                         <genre authority="marcgt">treaty</genre>
459                                 </xsl:when>
460                         </xsl:choose>
461                         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
462                         <xsl:choose>
463                                 <xsl:when test="$controlField008-29='1'">
464                                         <genre authority="marcgt">conference publication</genre>
465                                 </xsl:when>
466                         </xsl:choose>
467                 </xsl:if>
468                 <xsl:if test="$typeOf008='CF'">
469                         <xsl:variable name="controlField008-26" select="substring($controlField008,27,1)"/>
470                         <xsl:choose>
471                                 <xsl:when test="$controlField008-26='a'">
472                                         <genre authority="marcgt">numeric data</genre>
473                                 </xsl:when>
474                                 <xsl:when test="$controlField008-26='e'">
475                                         <genre authority="marcgt">database</genre>
476                                 </xsl:when>
477                                 <xsl:when test="$controlField008-26='f'">
478                                         <genre authority="marcgt">font</genre>
479                                 </xsl:when>
480                                 <xsl:when test="$controlField008-26='g'">
481                                         <genre authority="marcgt">game</genre>
482                                 </xsl:when>
483                         </xsl:choose>
484                 </xsl:if>
485                 <xsl:if test="$typeOf008='BK'">
486                         <xsl:if test="substring($controlField008,25,1)='j'">
487                                 <genre authority="marcgt">patent</genre>
488                         </xsl:if>
489                         <xsl:if test="substring($controlField008,25,1)='2'">
490                                 <genre authority="marcgt">offprint</genre>
491                         </xsl:if>
492                         <xsl:if test="substring($controlField008,31,1)='1'">
493                                 <genre authority="marcgt">festschrift</genre>
494                         </xsl:if>
495                         <xsl:variable name="controlField008-34" select="substring($controlField008,35,1)"/>
496                         <xsl:if
497                                 test="$controlField008-34='a' or $controlField008-34='b' or $controlField008-34='c' or $controlField008-34='d'">
498                                 <genre authority="marcgt">biography</genre>
499                         </xsl:if>
500                         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
501                         <xsl:choose>
502                                 <xsl:when test="$controlField008-33='e'">
503                                         <genre authority="marcgt">essay</genre>
504                                 </xsl:when>
505                                 <xsl:when test="$controlField008-33='d'">
506                                         <genre authority="marcgt">drama</genre>
507                                 </xsl:when>
508                                 <xsl:when test="$controlField008-33='c'">
509                                         <genre authority="marcgt">comic strip</genre>
510                                 </xsl:when>
511                                 <xsl:when test="$controlField008-33='l'">
512                                         <genre authority="marcgt">fiction</genre>
513                                 </xsl:when>
514                                 <xsl:when test="$controlField008-33='h'">
515                                         <genre authority="marcgt">humor, satire</genre>
516                                 </xsl:when>
517                                 <xsl:when test="$controlField008-33='i'">
518                                         <genre authority="marcgt">letter</genre>
519                                 </xsl:when>
520                                 <xsl:when test="$controlField008-33='f'">
521                                         <genre authority="marcgt">novel</genre>
522                                 </xsl:when>
523                                 <xsl:when test="$controlField008-33='j'">
524                                         <genre authority="marcgt">short story</genre>
525                                 </xsl:when>
526                                 <xsl:when test="$controlField008-33='s'">
527                                         <genre authority="marcgt">speech</genre>
528                                 </xsl:when>
529                         </xsl:choose>
530                 </xsl:if>
531                 <xsl:if test="$typeOf008='MU'">
532                         <xsl:variable name="controlField008-30-31" select="substring($controlField008,31,2)"/>
533                         <xsl:if test="contains($controlField008-30-31,'b')">
534                                 <genre authority="marcgt">biography</genre>
535                         </xsl:if>
536                         <xsl:if test="contains($controlField008-30-31,'c')">
537                                 <genre authority="marcgt">conference publication</genre>
538                         </xsl:if>
539                         <xsl:if test="contains($controlField008-30-31,'d')">
540                                 <genre authority="marcgt">drama</genre>
541                         </xsl:if>
542                         <xsl:if test="contains($controlField008-30-31,'e')">
543                                 <genre authority="marcgt">essay</genre>
544                         </xsl:if>
545                         <xsl:if test="contains($controlField008-30-31,'f')">
546                                 <genre authority="marcgt">fiction</genre>
547                         </xsl:if>
548                         <xsl:if test="contains($controlField008-30-31,'o')">
549                                 <genre authority="marcgt">folktale</genre>
550                         </xsl:if>
551                         <xsl:if test="contains($controlField008-30-31,'h')">
552                                 <genre authority="marcgt">history</genre>
553                         </xsl:if>
554                         <xsl:if test="contains($controlField008-30-31,'k')">
555                                 <genre authority="marcgt">humor, satire</genre>
556                         </xsl:if>
557                         <xsl:if test="contains($controlField008-30-31,'m')">
558                                 <genre authority="marcgt">memoir</genre>
559                         </xsl:if>
560                         <xsl:if test="contains($controlField008-30-31,'p')">
561                                 <genre authority="marcgt">poetry</genre>
562                         </xsl:if>
563                         <xsl:if test="contains($controlField008-30-31,'r')">
564                                 <genre authority="marcgt">rehearsal</genre>
565                         </xsl:if>
566                         <xsl:if test="contains($controlField008-30-31,'g')">
567                                 <genre authority="marcgt">reporting</genre>
568                         </xsl:if>
569                         <xsl:if test="contains($controlField008-30-31,'s')">
570                                 <genre authority="marcgt">sound</genre>
571                         </xsl:if>
572                         <xsl:if test="contains($controlField008-30-31,'l')">
573                                 <genre authority="marcgt">speech</genre>
574                         </xsl:if>
575                 </xsl:if>
576                 <xsl:if test="$typeOf008='VM'">
577                         <xsl:variable name="controlField008-33" select="substring($controlField008,34,1)"/>
578                         <xsl:choose>
579                                 <xsl:when test="$controlField008-33='a'">
580                                         <genre authority="marcgt">art original</genre>
581                                 </xsl:when>
582                                 <xsl:when test="$controlField008-33='b'">
583                                         <genre authority="marcgt">kit</genre>
584                                 </xsl:when>
585                                 <xsl:when test="$controlField008-33='c'">
586                                         <genre authority="marcgt">art reproduction</genre>
587                                 </xsl:when>
588                                 <xsl:when test="$controlField008-33='d'">
589                                         <genre authority="marcgt">diorama</genre>
590                                 </xsl:when>
591                                 <xsl:when test="$controlField008-33='f'">
592                                         <genre authority="marcgt">filmstrip</genre>
593                                 </xsl:when>
594                                 <xsl:when test="$controlField008-33='g'">
595                                         <genre authority="marcgt">legal article</genre>
596                                 </xsl:when>
597                                 <xsl:when test="$controlField008-33='i'">
598                                         <genre authority="marcgt">picture</genre>
599                                 </xsl:when>
600                                 <xsl:when test="$controlField008-33='k'">
601                                         <genre authority="marcgt">graphic</genre>
602                                 </xsl:when>
603                                 <xsl:when test="$controlField008-33='l'">
604                                         <genre authority="marcgt">technical drawing</genre>
605                                 </xsl:when>
606                                 <xsl:when test="$controlField008-33='m'">
607                                         <genre authority="marcgt">motion picture</genre>
608                                 </xsl:when>
609                                 <xsl:when test="$controlField008-33='n'">
610                                         <genre authority="marcgt">chart</genre>
611                                 </xsl:when>
612                                 <xsl:when test="$controlField008-33='o'">
613                                         <genre authority="marcgt">flash card</genre>
614                                 </xsl:when>
615                                 <xsl:when test="$controlField008-33='p'">
616                                         <genre authority="marcgt">microscope slide</genre>
617                                 </xsl:when>
618                                 <xsl:when
619                                         test="$controlField008-33='q' or marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
620                                         <genre authority="marcgt">model</genre>
621                                 </xsl:when>
622                                 <xsl:when test="$controlField008-33='r'">
623                                         <genre authority="marcgt">realia</genre>
624                                 </xsl:when>
625                                 <xsl:when test="$controlField008-33='s'">
626                                         <genre authority="marcgt">slide</genre>
627                                 </xsl:when>
628                                 <xsl:when test="$controlField008-33='t'">
629                                         <genre authority="marcgt">transparency</genre>
630                                 </xsl:when>
631                                 <xsl:when test="$controlField008-33='v'">
632                                         <genre authority="marcgt">videorecording</genre>
633                                 </xsl:when>
634                                 <xsl:when test="$controlField008-33='w'">
635                                         <genre authority="marcgt">toy</genre>
636                                 </xsl:when>
637                         </xsl:choose>
638                 </xsl:if>
639
640                 <!-- 1.20 047 genre tmee-->
641
642                 <xsl:for-each select="marc:datafield[@tag=047]">
643                         <genre authority="marcgt">
644                                 <xsl:attribute name="authority">
645                                         <xsl:value-of select="marc:subfield[@code='2']"/>
646                                 </xsl:attribute>
647                                 <xsl:call-template name="subfieldSelect">
648                                         <xsl:with-param name="codes">abcdef</xsl:with-param>
649                                         <xsl:with-param name="delimeter">-</xsl:with-param>
650                                 </xsl:call-template>
651                         </genre>
652                 </xsl:for-each>
653                 <xsl:for-each select="marc:datafield[@tag=655]">
654                         <genre authority="marcgt">
655                                 <xsl:attribute name="authority">
656                                         <xsl:value-of select="marc:subfield[@code='2']"/>
657                                 </xsl:attribute>
658                                 <xsl:call-template name="subfieldSelect">
659                                         <xsl:with-param name="codes">abvxyz</xsl:with-param>
660                                         <xsl:with-param name="delimeter">-</xsl:with-param>
661                                 </xsl:call-template>
662                         </genre>
663                 </xsl:for-each>
664                 <originInfo>
665                         <xsl:variable name="MARCpublicationCode"
666                                 select="normalize-space(substring($controlField008,16,3))"/>
667                         <xsl:if test="translate($MARCpublicationCode,'|','')">
668                                 <place>
669                                         <placeTerm>
670                                                 <xsl:attribute name="type">code</xsl:attribute>
671                                                 <xsl:attribute name="authority">marccountry</xsl:attribute>
672                                                 <xsl:value-of select="$MARCpublicationCode"/>
673                                         </placeTerm>
674                                 </place>
675                         </xsl:if>
676                         <xsl:for-each select="marc:datafield[@tag=044]/marc:subfield[@code='c']">
677                                 <place>
678                                         <placeTerm>
679                                                 <xsl:attribute name="type">code</xsl:attribute>
680                                                 <xsl:attribute name="authority">iso3166</xsl:attribute>
681                                                 <xsl:value-of select="."/>
682                                         </placeTerm>
683                                 </place>
684                         </xsl:for-each>
685                         <xsl:for-each select="marc:datafield[@tag=260]/marc:subfield[@code='a']">
686                                 <place>
687                                         <placeTerm>
688                                                 <xsl:attribute name="type">text</xsl:attribute>
689                                                 <xsl:call-template name="chopPunctuationFront">
690                                                         <xsl:with-param name="chopString">
691                                                                 <xsl:call-template name="chopPunctuation">
692                                                                         <xsl:with-param name="chopString" select="."/>
693                                                                 </xsl:call-template>
694                                                         </xsl:with-param>
695                                                 </xsl:call-template>
696                                         </placeTerm>
697                                 </place>
698                         </xsl:for-each>
699                         <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='m']">
700                                 <dateValid point="start">
701                                         <xsl:value-of select="."/>
702                                 </dateValid>
703                         </xsl:for-each>
704                         <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='n']">
705                                 <dateValid point="end">
706                                         <xsl:value-of select="."/>
707                                 </dateValid>
708                         </xsl:for-each>
709                         <xsl:for-each select="marc:datafield[@tag=046]/marc:subfield[@code='j']">
710                                 <dateModified>
711                                         <xsl:value-of select="."/>
712                                 </dateModified>
713                         </xsl:for-each>
714                         <xsl:for-each
715                                 select="marc:datafield[@tag=260]/marc:subfield[@code='b' or @code='c' or @code='g']">
716                                 <xsl:choose>
717                                         <xsl:when test="@code='b'">
718                                                 <publisher>
719                                                         <xsl:call-template name="chopPunctuation">
720                                                                 <xsl:with-param name="chopString" select="."/>
721                                                                 <xsl:with-param name="punctuation">
722                                                                         <xsl:text>:,;/ </xsl:text>
723                                                                 </xsl:with-param>
724                                                         </xsl:call-template>
725                                                 </publisher>
726                                         </xsl:when>
727                                         <xsl:when test="@code='c'">
728                                                 <dateIssued>
729                                                         <xsl:call-template name="chopPunctuation">
730                                                                 <xsl:with-param name="chopString" select="."/>
731                                                         </xsl:call-template>
732                                                 </dateIssued>
733                                         </xsl:when>
734                                         <xsl:when test="@code='g'">
735                                                 <dateCreated>
736                                                         <xsl:value-of select="."/>
737                                                 </dateCreated>
738                                         </xsl:when>
739                                 </xsl:choose>
740                         </xsl:for-each>
741                         <xsl:variable name="dataField260c">
742                                 <xsl:call-template name="chopPunctuation">
743                                         <xsl:with-param name="chopString"
744                                                 select="marc:datafield[@tag=260]/marc:subfield[@code='c']"/>
745                                 </xsl:call-template>
746                         </xsl:variable>
747                         <xsl:variable name="controlField008-7-10"
748                                 select="normalize-space(substring($controlField008, 8, 4))"/>
749                         <xsl:variable name="controlField008-11-14"
750                                 select="normalize-space(substring($controlField008, 12, 4))"/>
751                         <xsl:variable name="controlField008-6"
752                                 select="normalize-space(substring($controlField008, 7, 1))"/>
753                         <xsl:if
754                                 test="$controlField008-6='e' or $controlField008-6='p' or $controlField008-6='r' or $controlField008-6='t' or $controlField008-6='s'">
755                                 <xsl:if test="$controlField008-7-10 and ($controlField008-7-10 != $dataField260c)">
756                                         <dateIssued encoding="marc">
757                                                 <xsl:value-of select="$controlField008-7-10"/>
758                                         </dateIssued>
759                                 </xsl:if>
760                         </xsl:if>
761                         <xsl:if
762                                 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'">
763                                 <xsl:if test="$controlField008-7-10">
764                                         <dateIssued encoding="marc" point="start">
765                                                 <xsl:value-of select="$controlField008-7-10"/>
766                                         </dateIssued>
767                                 </xsl:if>
768                         </xsl:if>
769                         <xsl:if
770                                 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'">
771                                 <xsl:if test="$controlField008-11-14">
772                                         <dateIssued encoding="marc" point="end">
773                                                 <xsl:value-of select="$controlField008-11-14"/>
774                                         </dateIssued>
775                                 </xsl:if>
776                         </xsl:if>
777                         <xsl:if test="$controlField008-6='q'">
778                                 <xsl:if test="$controlField008-7-10">
779                                         <dateIssued encoding="marc" point="start" qualifier="questionable">
780                                                 <xsl:value-of select="$controlField008-7-10"/>
781                                         </dateIssued>
782                                 </xsl:if>
783                         </xsl:if>
784                         <xsl:if test="$controlField008-6='q'">
785                                 <xsl:if test="$controlField008-11-14">
786                                         <dateIssued encoding="marc" point="end" qualifier="questionable">
787                                                 <xsl:value-of select="$controlField008-11-14"/>
788                                         </dateIssued>
789                                 </xsl:if>
790                         </xsl:if>
791                         <xsl:if test="$controlField008-6='t'">
792                                 <xsl:if test="$controlField008-11-14">
793                                         <copyrightDate encoding="marc">
794                                                 <xsl:value-of select="$controlField008-11-14"/>
795                                         </copyrightDate>
796                                 </xsl:if>
797                         </xsl:if>
798                         <xsl:for-each
799                                 select="marc:datafield[@tag=033][@ind1=0 or @ind1=1]/marc:subfield[@code='a']">
800                                 <dateCaptured encoding="iso8601">
801                                         <xsl:value-of select="."/>
802                                 </dateCaptured>
803                         </xsl:for-each>
804                         <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][1]">
805                                 <dateCaptured encoding="iso8601" point="start">
806                                         <xsl:value-of select="."/>
807                                 </dateCaptured>
808                         </xsl:for-each>
809                         <xsl:for-each select="marc:datafield[@tag=033][@ind1=2]/marc:subfield[@code='a'][2]">
810                                 <dateCaptured encoding="iso8601" point="end">
811                                         <xsl:value-of select="."/>
812                                 </dateCaptured>
813                         </xsl:for-each>
814                         <xsl:for-each select="marc:datafield[@tag=250]/marc:subfield[@code='a']">
815                                 <edition>
816                                         <xsl:value-of select="."/>
817                                 </edition>
818                         </xsl:for-each>
819                         <xsl:for-each select="marc:leader">
820                                 <issuance>
821                                         <xsl:choose>
822                                                 <xsl:when
823                                                         test="$leader7='a' or $leader7='c' or $leader7='d' or $leader7='m'"
824                                                         >monographic</xsl:when>
825                                                 <xsl:when test="$leader7='b' or $leader7='i' or $leader7='s'"
826                                                 >continuing</xsl:when>
827                                         </xsl:choose>
828                                 </issuance>
829                         </xsl:for-each>
830                         <xsl:for-each select="marc:datafield[@tag=310]|marc:datafield[@tag=321]">
831                                 <frequency>
832                                         <xsl:call-template name="subfieldSelect">
833                                                 <xsl:with-param name="codes">ab</xsl:with-param>
834                                         </xsl:call-template>
835                                 </frequency>
836                         </xsl:for-each>
837                 </originInfo>
838                 <xsl:variable name="controlField008-35-37"
839                         select="normalize-space(translate(substring($controlField008,36,3),'|#',''))"/>
840                 <xsl:if test="$controlField008-35-37">
841                         <language>
842                                 <languageTerm authority="iso639-2b" type="code">
843                                         <xsl:value-of select="substring($controlField008,36,3)"/>
844                                 </languageTerm>
845                         </language>
846                 </xsl:if>
847                 <xsl:for-each select="marc:datafield[@tag=041]">
848                         <xsl:for-each
849                                 select="marc:subfield[@code='a' or @code='b' or @code='d' or @code='e' or @code='f' or @code='g' or @code='h']">
850                                 <xsl:variable name="langCodes" select="."/>
851                                 <xsl:choose>
852                                         <xsl:when test="../marc:subfield[@code='2']='rfc3066'">
853                                                 <!-- not stacked but could be repeated -->
854                                                 <xsl:call-template name="rfcLanguages">
855                                                         <xsl:with-param name="nodeNum">
856                                                                 <xsl:value-of select="1"/>
857                                                         </xsl:with-param>
858                                                         <xsl:with-param name="usedLanguages">
859                                                                 <xsl:text/>
860                                                         </xsl:with-param>
861                                                         <xsl:with-param name="controlField008-35-37">
862                                                                 <xsl:value-of select="$controlField008-35-37"/>
863                                                         </xsl:with-param>
864                                                 </xsl:call-template>
865                                         </xsl:when>
866                                         <xsl:otherwise>
867                                                 <!-- iso -->
868                                                 <xsl:variable name="allLanguages">
869                                                         <xsl:copy-of select="$langCodes"/>
870                                                 </xsl:variable>
871                                                 <xsl:variable name="currentLanguage">
872                                                         <xsl:value-of select="substring($allLanguages,1,3)"/>
873                                                 </xsl:variable>
874                                                 <xsl:call-template name="isoLanguage">
875                                                         <xsl:with-param name="currentLanguage">
876                                                                 <xsl:value-of select="substring($allLanguages,1,3)"/>
877                                                         </xsl:with-param>
878                                                         <xsl:with-param name="remainingLanguages">
879                                                                 <xsl:value-of
880                                                                         select="substring($allLanguages,4,string-length($allLanguages)-3)"
881                                                                 />
882                                                         </xsl:with-param>
883                                                         <xsl:with-param name="usedLanguages">
884                                                                 <xsl:if test="$controlField008-35-37">
885                                                                         <xsl:value-of select="$controlField008-35-37"/>
886                                                                 </xsl:if>
887                                                         </xsl:with-param>
888                                                 </xsl:call-template>
889                                         </xsl:otherwise>
890                                 </xsl:choose>
891                         </xsl:for-each>
892                 </xsl:for-each>
893                 <xsl:variable name="physicalDescription">
894                         <!--3.2 change tmee 007/11 -->
895                         <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='a']">
896                                 <digitalOrigin>reformatted digital</digitalOrigin>
897                         </xsl:if>
898                         <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='b']">
899                                 <digitalOrigin>digitized microfilm</digitalOrigin>
900                         </xsl:if>
901                         <xsl:if test="$typeOf008='CF' and marc:controlfield[@tag=007][substring(.,12,1)='d']">
902                                 <digitalOrigin>digitized other analog</digitalOrigin>
903                         </xsl:if>
904                         <xsl:variable name="controlField008-23" select="substring($controlField008,24,1)"/>
905                         <xsl:variable name="controlField008-29" select="substring($controlField008,30,1)"/>
906                         <xsl:variable name="check008-23">
907                                 <xsl:if
908                                         test="$typeOf008='BK' or $typeOf008='MU' or $typeOf008='SE' or $typeOf008='MM'">
909                                         <xsl:value-of select="true()"/>
910                                 </xsl:if>
911                         </xsl:variable>
912                         <xsl:variable name="check008-29">
913                                 <xsl:if test="$typeOf008='MP' or $typeOf008='VM'">
914                                         <xsl:value-of select="true()"/>
915                                 </xsl:if>
916                         </xsl:variable>
917                         <xsl:choose>
918                                 <xsl:when
919                                         test="($check008-23 and $controlField008-23='f') or ($check008-29 and $controlField008-29='f')">
920                                         <form authority="marcform">braille</form>
921                                 </xsl:when>
922                                 <xsl:when
923                                         test="($controlField008-23=' ' and ($leader6='c' or $leader6='d')) or (($typeOf008='BK' or $typeOf008='SE') and ($controlField008-23=' ' or $controlField008='r'))">
924                                         <form authority="marcform">print</form>
925                                 </xsl:when>
926                                 <xsl:when
927                                         test="$leader6 = 'm' or ($check008-23 and $controlField008-23='s') or ($check008-29 and $controlField008-29='s')">
928                                         <form authority="marcform">electronic</form>
929                                 </xsl:when>
930                                 <xsl:when
931                                         test="($check008-23 and $controlField008-23='b') or ($check008-29 and $controlField008-29='b')">
932                                         <form authority="marcform">microfiche</form>
933                                 </xsl:when>
934                                 <xsl:when
935                                         test="($check008-23 and $controlField008-23='a') or ($check008-29 and $controlField008-29='a')">
936                                         <form authority="marcform">microfilm</form>
937                                 </xsl:when>
938                         </xsl:choose>
939                         <!-- 1/04 fix -->
940                         <xsl:if test="marc:datafield[@tag=130]/marc:subfield[@code='h']">
941                                 <form authority="gmd">
942                                         <xsl:call-template name="chopBrackets">
943                                                 <xsl:with-param name="chopString">
944                                                         <xsl:value-of select="marc:datafield[@tag=130]/marc:subfield[@code='h']"
945                                                         />
946                                                 </xsl:with-param>
947                                         </xsl:call-template>
948                                 </form>
949                         </xsl:if>
950                         <xsl:if test="marc:datafield[@tag=240]/marc:subfield[@code='h']">
951                                 <form authority="gmd">
952                                         <xsl:call-template name="chopBrackets">
953                                                 <xsl:with-param name="chopString">
954                                                         <xsl:value-of select="marc:datafield[@tag=240]/marc:subfield[@code='h']"
955                                                         />
956                                                 </xsl:with-param>
957                                         </xsl:call-template>
958                                 </form>
959                         </xsl:if>
960                         <xsl:if test="marc:datafield[@tag=242]/marc:subfield[@code='h']">
961                                 <form authority="gmd">
962                                         <xsl:call-template name="chopBrackets">
963                                                 <xsl:with-param name="chopString">
964                                                         <xsl:value-of select="marc:datafield[@tag=242]/marc:subfield[@code='h']"
965                                                         />
966                                                 </xsl:with-param>
967                                         </xsl:call-template>
968                                 </form>
969                         </xsl:if>
970                         <xsl:if test="marc:datafield[@tag=245]/marc:subfield[@code='h']">
971                                 <form authority="gmd">
972                                         <xsl:call-template name="chopBrackets">
973                                                 <xsl:with-param name="chopString">
974                                                         <xsl:value-of select="marc:datafield[@tag=245]/marc:subfield[@code='h']"
975                                                         />
976                                                 </xsl:with-param>
977                                         </xsl:call-template>
978                                 </form>
979                         </xsl:if>
980                         <xsl:if test="marc:datafield[@tag=246]/marc:subfield[@code='h']">
981                                 <form authority="gmd">
982                                         <xsl:call-template name="chopBrackets">
983                                                 <xsl:with-param name="chopString">
984                                                         <xsl:value-of select="marc:datafield[@tag=246]/marc:subfield[@code='h']"
985                                                         />
986                                                 </xsl:with-param>
987                                         </xsl:call-template>
988                                 </form>
989                         </xsl:if>
990                         <xsl:if test="marc:datafield[@tag=730]/marc:subfield[@code='h']">
991                                 <form authority="gmd">
992                                         <xsl:call-template name="chopBrackets">
993                                                 <xsl:with-param name="chopString">
994                                                         <xsl:value-of select="marc:datafield[@tag=730]/marc:subfield[@code='h']"
995                                                         />
996                                                 </xsl:with-param>
997                                         </xsl:call-template>
998                                 </form>
999                         </xsl:if>
1000                         <xsl:for-each select="marc:datafield[@tag=256]/marc:subfield[@code='a']">
1001                                 <form>
1002                                         <xsl:value-of select="."/>
1003                                 </form>
1004                         </xsl:for-each>
1005                         <xsl:for-each select="marc:controlfield[@tag=007][substring(text(),1,1)='c']">
1006                                 <xsl:choose>
1007                                         <xsl:when test="substring(text(),14,1)='a'">
1008                                                 <reformattingQuality>access</reformattingQuality>
1009                                         </xsl:when>
1010                                         <xsl:when test="substring(text(),14,1)='p'">
1011                                                 <reformattingQuality>preservation</reformattingQuality>
1012                                         </xsl:when>
1013                                         <xsl:when test="substring(text(),14,1)='r'">
1014                                                 <reformattingQuality>replacement</reformattingQuality>
1015                                         </xsl:when>
1016                                 </xsl:choose>
1017                         </xsl:for-each>
1018                         <!--3.2 change tmee 007/01 -->
1019                         <xsl:if
1020                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='b']">
1021                                 <form authority="smd">chip cartridge</form>
1022                         </xsl:if>
1023                         <xsl:if
1024                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='c']">
1025                                 <form authority="smd">computer optical disc cartridge</form>
1026                         </xsl:if>
1027                         <xsl:if
1028                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='j']">
1029                                 <form authority="smd">magnetic disc</form>
1030                         </xsl:if>
1031                         <xsl:if
1032                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='m']">
1033                                 <form authority="smd">magneto-optical disc</form>
1034                         </xsl:if>
1035                         <xsl:if
1036                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='o']">
1037                                 <form authority="smd">optical disc</form>
1038                         </xsl:if>
1039                         <xsl:if
1040                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='r']">
1041                                 <form authority="smd">remote</form>
1042                         </xsl:if>
1043                         <xsl:if
1044                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='a']">
1045                                 <form authority="smd">tape cartridge</form>
1046                         </xsl:if>
1047                         <xsl:if
1048                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='f']">
1049                                 <form authority="smd">tape cassette</form>
1050                         </xsl:if>
1051                         <xsl:if
1052                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='c'][substring(text(),2,1)='h']">
1053                                 <form authority="smd">tape reel</form>
1054                         </xsl:if>
1055
1056                         <xsl:if
1057                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='a']">
1058                                 <form authority="smd">celestial globe</form>
1059                         </xsl:if>
1060                         <xsl:if
1061                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='e']">
1062                                 <form authority="smd">earth moon globe</form>
1063                         </xsl:if>
1064                         <xsl:if
1065                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='b']">
1066                                 <form authority="smd">planetary or lunar globe</form>
1067                         </xsl:if>
1068                         <xsl:if
1069                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='d'][substring(text(),2,1)='c']">
1070                                 <form authority="smd">terrestrial globe</form>
1071                         </xsl:if>
1072
1073                         <xsl:if
1074                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='o'][substring(text(),2,1)='o']">
1075                                 <form authority="smd">kit</form>
1076                         </xsl:if>
1077
1078                         <xsl:if
1079                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='d']">
1080                                 <form authority="smd">atlas</form>
1081                         </xsl:if>
1082                         <xsl:if
1083                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='g']">
1084                                 <form authority="smd">diagram</form>
1085                         </xsl:if>
1086                         <xsl:if
1087                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='j']">
1088                                 <form authority="smd">map</form>
1089                         </xsl:if>
1090                         <xsl:if
1091                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='q']">
1092                                 <form authority="smd">model</form>
1093                         </xsl:if>
1094                         <xsl:if
1095                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='k']">
1096                                 <form authority="smd">profile</form>
1097                         </xsl:if>
1098                         <xsl:if
1099                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='r']">
1100                                 <form authority="smd">remote-sensing image</form>
1101                         </xsl:if>
1102                         <xsl:if
1103                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='s']">
1104                                 <form authority="smd">section</form>
1105                         </xsl:if>
1106                         <xsl:if
1107                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='a'][substring(text(),2,1)='y']">
1108                                 <form authority="smd">view</form>
1109                         </xsl:if>
1110
1111                         <xsl:if
1112                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='a']">
1113                                 <form authority="smd">aperture card</form>
1114                         </xsl:if>
1115                         <xsl:if
1116                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='e']">
1117                                 <form authority="smd">microfiche</form>
1118                         </xsl:if>
1119                         <xsl:if
1120                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='f']">
1121                                 <form authority="smd">microfiche cassette</form>
1122                         </xsl:if>
1123                         <xsl:if
1124                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='b']">
1125                                 <form authority="smd">microfilm cartridge</form>
1126                         </xsl:if>
1127                         <xsl:if
1128                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='c']">
1129                                 <form authority="smd">microfilm cassette</form>
1130                         </xsl:if>
1131                         <xsl:if
1132                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='d']">
1133                                 <form authority="smd">microfilm reel</form>
1134                         </xsl:if>
1135                         <xsl:if
1136                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='h'][substring(text(),2,1)='g']">
1137                                 <form authority="smd">microopaque</form>
1138                         </xsl:if>
1139
1140                         <xsl:if
1141                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='c']">
1142                                 <form authority="smd">film cartridge</form>
1143                         </xsl:if>
1144                         <xsl:if
1145                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='f']">
1146                                 <form authority="smd">film cassette</form>
1147                         </xsl:if>
1148                         <xsl:if
1149                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='m'][substring(text(),2,1)='r']">
1150                                 <form authority="smd">film reel</form>
1151                         </xsl:if>
1152
1153                         <xsl:if
1154                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='n']">
1155                                 <form authority="smd">chart</form>
1156                         </xsl:if>
1157                         <xsl:if
1158                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='c']">
1159                                 <form authority="smd">collage</form>
1160                         </xsl:if>
1161                         <xsl:if
1162                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='d']">
1163                                 <form authority="smd">drawing</form>
1164                         </xsl:if>
1165                         <xsl:if
1166                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='o']">
1167                                 <form authority="smd">flash card</form>
1168                         </xsl:if>
1169                         <xsl:if
1170                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='e']">
1171                                 <form authority="smd">painting</form>
1172                         </xsl:if>
1173                         <xsl:if
1174                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='f']">
1175                                 <form authority="smd">photomechanical print</form>
1176                         </xsl:if>
1177                         <xsl:if
1178                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='g']">
1179                                 <form authority="smd">photonegative</form>
1180                         </xsl:if>
1181                         <xsl:if
1182                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='h']">
1183                                 <form authority="smd">photoprint</form>
1184                         </xsl:if>
1185                         <xsl:if
1186                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='i']">
1187                                 <form authority="smd">picture</form>
1188                         </xsl:if>
1189                         <xsl:if
1190                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='j']">
1191                                 <form authority="smd">print</form>
1192                         </xsl:if>
1193                         <xsl:if
1194                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='k'][substring(text(),2,1)='l']">
1195                                 <form authority="smd">technical drawing</form>
1196                         </xsl:if>
1197
1198                         <xsl:if
1199                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='q'][substring(text(),2,1)='q']">
1200                                 <form authority="smd">notated music</form>
1201                         </xsl:if>
1202
1203                         <xsl:if
1204                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='d']">
1205                                 <form authority="smd">filmslip</form>
1206                         </xsl:if>
1207                         <xsl:if
1208                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='c']">
1209                                 <form authority="smd">filmstrip cartridge</form>
1210                         </xsl:if>
1211                         <xsl:if
1212                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='o']">
1213                                 <form authority="smd">filmstrip roll</form>
1214                         </xsl:if>
1215                         <xsl:if
1216                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='f']">
1217                                 <form authority="smd">other filmstrip type</form>
1218                         </xsl:if>
1219                         <xsl:if
1220                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='s']">
1221                                 <form authority="smd">slide</form>
1222                         </xsl:if>
1223                         <xsl:if
1224                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='g'][substring(text(),2,1)='t']">
1225                                 <form authority="smd">transparency</form>
1226                         </xsl:if>
1227                         <xsl:if
1228                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='r'][substring(text(),2,1)='r']">
1229                                 <form authority="smd">remote-sensing image</form>
1230                         </xsl:if>
1231                         <xsl:if
1232                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='e']">
1233                                 <form authority="smd">cylinder</form>
1234                         </xsl:if>
1235                         <xsl:if
1236                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='q']">
1237                                 <form authority="smd">roll</form>
1238                         </xsl:if>
1239                         <xsl:if
1240                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='g']">
1241                                 <form authority="smd">sound cartridge</form>
1242                         </xsl:if>
1243                         <xsl:if
1244                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='s']">
1245                                 <form authority="smd">sound cassette</form>
1246                         </xsl:if>
1247                         <xsl:if
1248                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='d']">
1249                                 <form authority="smd">sound disc</form>
1250                         </xsl:if>
1251                         <xsl:if
1252                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='t']">
1253                                 <form authority="smd">sound-tape reel</form>
1254                         </xsl:if>
1255                         <xsl:if
1256                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='i']">
1257                                 <form authority="smd">sound-track film</form>
1258                         </xsl:if>
1259                         <xsl:if
1260                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='s'][substring(text(),2,1)='w']">
1261                                 <form authority="smd">wire recording</form>
1262                         </xsl:if>
1263
1264                         <xsl:if
1265                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='c']">
1266                                 <form authority="smd">braille</form>
1267                         </xsl:if>
1268                         <xsl:if
1269                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='b']">
1270                                 <form authority="smd">combination</form>
1271                         </xsl:if>
1272                         <xsl:if
1273                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='a']">
1274                                 <form authority="smd">moon</form>
1275                         </xsl:if>
1276                         <xsl:if
1277                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='f'][substring(text(),2,1)='d']">
1278                                 <form authority="smd">tactile, with no writing system</form>
1279                         </xsl:if>
1280
1281                         <xsl:if
1282                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='c']">
1283                                 <form authority="smd">braille</form>
1284                         </xsl:if>
1285                         <xsl:if
1286                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='b']">
1287                                 <form authority="smd">large print</form>
1288                         </xsl:if>
1289                         <xsl:if
1290                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='a']">
1291                                 <form authority="smd">regular print</form>
1292                         </xsl:if>
1293                         <xsl:if
1294                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='t'][substring(text(),2,1)='d']">
1295                                 <form authority="smd">text in looseleaf binder</form>
1296                         </xsl:if>
1297
1298                         <xsl:if
1299                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='c']">
1300                                 <form authority="smd">videocartridge</form>
1301                         </xsl:if>
1302                         <xsl:if
1303                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='f']">
1304                                 <form authority="smd">videocassette</form>
1305                         </xsl:if>
1306                         <xsl:if
1307                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='d']">
1308                                 <form authority="smd">videodisc</form>
1309                         </xsl:if>
1310                         <xsl:if
1311                                 test="marc:controlfield[@tag=007][substring(text(),1,1)='v'][substring(text(),2,1)='r']">
1312                                 <form authority="smd">videoreel</form>
1313                         </xsl:if>
1314
1315                         <xsl:for-each
1316                                 select="marc:datafield[@tag=856]/marc:subfield[@code='q'][string-length(.)&gt;1]">
1317                                 <internetMediaType>
1318                                         <xsl:value-of select="."/>
1319                                 </internetMediaType>
1320                         </xsl:for-each>
1321                         <xsl:for-each select="marc:datafield[@tag=300]">
1322                                 <extent>
1323                                         <xsl:call-template name="subfieldSelect">
1324                                                 <xsl:with-param name="codes">abce</xsl:with-param>
1325                                         </xsl:call-template>
1326                                 </extent>
1327                         </xsl:for-each>
1328                 </xsl:variable>
1329                 <xsl:if test="string-length(normalize-space($physicalDescription))">
1330                         <physicalDescription>
1331                                 <xsl:copy-of select="$physicalDescription"/>
1332                         </physicalDescription>
1333                 </xsl:if>
1334                 <xsl:for-each select="marc:datafield[@tag=520]">
1335                         <abstract>
1336                                 <xsl:call-template name="uri"/>
1337                                 <xsl:call-template name="subfieldSelect">
1338                                         <xsl:with-param name="codes">ab</xsl:with-param>
1339                                 </xsl:call-template>
1340                         </abstract>
1341                 </xsl:for-each>
1342                 <xsl:for-each select="marc:datafield[@tag=505]">
1343                         <tableOfContents>
1344                                 <xsl:call-template name="uri"/>
1345                                 <xsl:call-template name="subfieldSelect">
1346                                         <xsl:with-param name="codes">agrt</xsl:with-param>
1347                                 </xsl:call-template>
1348                         </tableOfContents>
1349                 </xsl:for-each>
1350                 <xsl:for-each select="marc:datafield[@tag=521]">
1351                         <targetAudience>
1352                                 <xsl:call-template name="subfieldSelect">
1353                                         <xsl:with-param name="codes">ab</xsl:with-param>
1354                                 </xsl:call-template>
1355                         </targetAudience>
1356                 </xsl:for-each>
1357                 <xsl:if test="$typeOf008='BK' or $typeOf008='CF' or $typeOf008='MU' or $typeOf008='VM'">
1358                         <xsl:variable name="controlField008-22" select="substring($controlField008,23,1)"/>
1359                         <xsl:choose>
1360                                 <!-- 01/04 fix -->
1361                                 <xsl:when test="$controlField008-22='d'">
1362                                         <targetAudience authority="marctarget">adolescent</targetAudience>
1363                                 </xsl:when>
1364                                 <xsl:when test="$controlField008-22='e'">
1365                                         <targetAudience authority="marctarget">adult</targetAudience>
1366                                 </xsl:when>
1367                                 <xsl:when test="$controlField008-22='g'">
1368                                         <targetAudience authority="marctarget">general</targetAudience>
1369                                 </xsl:when>
1370                                 <xsl:when
1371                                         test="$controlField008-22='b' or $controlField008-22='c' or $controlField008-22='j'">
1372                                         <targetAudience authority="marctarget">juvenile</targetAudience>
1373                                 </xsl:when>
1374                                 <xsl:when test="$controlField008-22='a'">
1375                                         <targetAudience authority="marctarget">preschool</targetAudience>
1376                                 </xsl:when>
1377                                 <xsl:when test="$controlField008-22='f'">
1378                                         <targetAudience authority="marctarget">specialized</targetAudience>
1379                                 </xsl:when>
1380                         </xsl:choose>
1381                 </xsl:if>
1382                 <xsl:for-each select="marc:datafield[@tag=245]/marc:subfield[@code='c']">
1383                         <note type="statement of responsibility">
1384                                 <xsl:value-of select="."/>
1385                         </note>
1386                 </xsl:for-each>
1387                 <xsl:for-each select="marc:datafield[@tag=500]">
1388                         <note>
1389                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1390                                 <xsl:call-template name="uri"/>
1391                         </note>
1392                 </xsl:for-each>
1393
1394                 <!--3.2 change tmee additional note fields-->
1395
1396         <xsl:for-each select="marc:datafield[@tag=502]">
1397             <note type="thesis">
1398                 <xsl:call-template name="uri"/>
1399                 <xsl:variable name="str">
1400                     <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1401                         <xsl:value-of select="."/>
1402                         <xsl:text> </xsl:text>
1403                     </xsl:for-each>
1404                 </xsl:variable>
1405                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1406             </note>
1407         </xsl:for-each>
1408
1409         <xsl:for-each select="marc:datafield[@tag=504]">
1410             <note type="bibliography">
1411                 <xsl:call-template name="uri"/>
1412                 <xsl:variable name="str">
1413                     <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1414                         <xsl:value-of select="."/>
1415                         <xsl:text> </xsl:text>
1416                     </xsl:for-each>
1417                 </xsl:variable>
1418                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1419             </note>
1420         </xsl:for-each>
1421
1422         <xsl:for-each select="marc:datafield[@tag=508]">
1423             <note type="creation/production credits">
1424                 <xsl:call-template name="uri"/>
1425                 <xsl:variable name="str">
1426                     <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1427                         <xsl:value-of select="."/>
1428                         <xsl:text> </xsl:text>
1429                     </xsl:for-each>
1430                 </xsl:variable>
1431                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1432             </note>
1433         </xsl:for-each>
1434
1435                 <xsl:for-each select="marc:datafield[@tag=506]">
1436                         <note type="restrictions">
1437                                 <xsl:call-template name="uri"/>
1438                                 <xsl:variable name="str">
1439                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1440                                                 <xsl:value-of select="."/>
1441                                                 <xsl:text> </xsl:text>
1442                                         </xsl:for-each>
1443                                 </xsl:variable>
1444                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1445                         </note>
1446                 </xsl:for-each>
1447
1448                 <xsl:for-each select="marc:datafield[@tag=510]">
1449                         <note type="citation/reference">
1450                                 <xsl:call-template name="uri"/>
1451                                 <xsl:variable name="str">
1452                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1453                                                 <xsl:value-of select="."/>
1454                                                 <xsl:text> </xsl:text>
1455                                         </xsl:for-each>
1456                                 </xsl:variable>
1457                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1458                         </note>
1459                 </xsl:for-each>
1460
1461
1462                 <xsl:for-each select="marc:datafield[@tag=511]">
1463                         <note type="performers">
1464                                 <xsl:call-template name="uri"/>
1465                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1466                         </note>
1467                 </xsl:for-each>
1468                 <xsl:for-each select="marc:datafield[@tag=518]">
1469                         <note type="venue">
1470                                 <xsl:call-template name="uri"/>
1471                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1472                         </note>
1473                 </xsl:for-each>
1474
1475                 <xsl:for-each select="marc:datafield[@tag=530]">
1476                         <note type="additional physical form">
1477                                 <xsl:call-template name="uri"/>
1478                                 <xsl:variable name="str">
1479                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1480                                                 <xsl:value-of select="."/>
1481                                                 <xsl:text> </xsl:text>
1482                                         </xsl:for-each>
1483                                 </xsl:variable>
1484                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1485                         </note>
1486                 </xsl:for-each>
1487
1488                 <xsl:for-each select="marc:datafield[@tag=533]">
1489                         <note type="reproduction">
1490                                 <xsl:call-template name="uri"/>
1491                                 <xsl:variable name="str">
1492                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1493                                                 <xsl:value-of select="."/>
1494                                                 <xsl:text> </xsl:text>
1495                                         </xsl:for-each>
1496                                 </xsl:variable>
1497                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1498                         </note>
1499                 </xsl:for-each>
1500
1501                 <xsl:for-each select="marc:datafield[@tag=534]">
1502                         <note type="original version">
1503                                 <xsl:call-template name="uri"/>
1504                                 <xsl:variable name="str">
1505                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1506                                                 <xsl:value-of select="."/>
1507                                                 <xsl:text> </xsl:text>
1508                                         </xsl:for-each>
1509                                 </xsl:variable>
1510                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1511                         </note>
1512                 </xsl:for-each>
1513
1514                 <xsl:for-each select="marc:datafield[@tag=538]">
1515                         <note type="system details">
1516                                 <xsl:call-template name="uri"/>
1517                                 <xsl:variable name="str">
1518                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1519                                                 <xsl:value-of select="."/>
1520                                                 <xsl:text> </xsl:text>
1521                                         </xsl:for-each>
1522                                 </xsl:variable>
1523                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1524                         </note>
1525                 </xsl:for-each>
1526
1527                 <xsl:for-each select="marc:datafield[@tag=583]">
1528                         <note type="action">
1529                                 <xsl:call-template name="uri"/>
1530                                 <xsl:variable name="str">
1531                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1532                                                 <xsl:value-of select="."/>
1533                                                 <xsl:text> </xsl:text>
1534                                         </xsl:for-each>
1535                                 </xsl:variable>
1536                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1537                         </note>
1538                 </xsl:for-each>
1539
1540                 <xsl:for-each
1541             select="marc:datafield[@tag=501 or @tag=507 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]">
1542                         <note>
1543                                 <xsl:call-template name="uri"/>
1544                                 <xsl:variable name="str">
1545                                         <xsl:for-each select="marc:subfield[@code!='6' or @code!='8']">
1546                                                 <xsl:value-of select="."/>
1547                                                 <xsl:text> </xsl:text>
1548                                         </xsl:for-each>
1549                                 </xsl:variable>
1550                                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
1551                         </note>
1552                 </xsl:for-each>
1553                 <xsl:for-each
1554                         select="marc:datafield[@tag=034][marc:subfield[@code='d' or @code='e' or @code='f' or @code='g']]">
1555                         <subject>
1556                                 <cartographics>
1557                                         <coordinates>
1558                                                 <xsl:call-template name="subfieldSelect">
1559                                                         <xsl:with-param name="codes">defg</xsl:with-param>
1560                                                 </xsl:call-template>
1561                                         </coordinates>
1562                                 </cartographics>
1563                         </subject>
1564                 </xsl:for-each>
1565                 <xsl:for-each select="marc:datafield[@tag=043]">
1566                         <subject>
1567                                 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1568                                         <geographicCode>
1569                                                 <xsl:attribute name="authority">
1570                                                         <xsl:if test="@code='a'">
1571                                                                 <xsl:text>marcgac</xsl:text>
1572                                                         </xsl:if>
1573                                                         <xsl:if test="@code='b'">
1574                                                                 <xsl:value-of select="following-sibling::marc:subfield[@code=2]"/>
1575                                                         </xsl:if>
1576                                                         <xsl:if test="@code='c'">
1577                                                                 <xsl:text>iso3166</xsl:text>
1578                                                         </xsl:if>
1579                                                 </xsl:attribute>
1580                                                 <xsl:value-of select="self::marc:subfield"/>
1581                                         </geographicCode>
1582                                 </xsl:for-each>
1583                         </subject>
1584                 </xsl:for-each>
1585                 <!-- tmee 2006/11/27 -->
1586                 <xsl:for-each select="marc:datafield[@tag=255]">
1587                         <subject>
1588                                 <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='c']">
1589                                         <cartographics>
1590                                                 <xsl:if test="@code='a'">
1591                                                         <scale>
1592                                                                 <xsl:value-of select="."/>
1593                                                         </scale>
1594                                                 </xsl:if>
1595                                                 <xsl:if test="@code='b'">
1596                                                         <projection>
1597                                                                 <xsl:value-of select="."/>
1598                                                         </projection>
1599                                                 </xsl:if>
1600                                                 <xsl:if test="@code='c'">
1601                                                         <coordinates>
1602                                                                 <xsl:value-of select="."/>
1603                                                         </coordinates>
1604                                                 </xsl:if>
1605                                         </cartographics>
1606                                 </xsl:for-each>
1607                         </subject>
1608                 </xsl:for-each>
1609
1610                 <xsl:apply-templates select="marc:datafield[653 &gt;= @tag and @tag &gt;= 600]"/>
1611                 <xsl:apply-templates select="marc:datafield[@tag=656]"/>
1612                 <xsl:for-each select="marc:datafield[@tag=752 or @tag=662]">
1613                         <subject>
1614                                 <hierarchicalGeographic>
1615                                         <xsl:for-each select="marc:subfield[@code='a']">
1616                                                 <country>
1617                                                         <xsl:call-template name="chopPunctuation">
1618                                                                 <xsl:with-param name="chopString" select="."/>
1619                                                         </xsl:call-template>
1620                                                 </country>
1621                                         </xsl:for-each>
1622                                         <xsl:for-each select="marc:subfield[@code='b']">
1623                                                 <state>
1624                                                         <xsl:call-template name="chopPunctuation">
1625                                                                 <xsl:with-param name="chopString" select="."/>
1626                                                         </xsl:call-template>
1627                                                 </state>
1628                                         </xsl:for-each>
1629                                         <xsl:for-each select="marc:subfield[@code='c']">
1630                                                 <county>
1631                                                         <xsl:call-template name="chopPunctuation">
1632                                                                 <xsl:with-param name="chopString" select="."/>
1633                                                         </xsl:call-template>
1634                                                 </county>
1635                                         </xsl:for-each>
1636                                         <xsl:for-each select="marc:subfield[@code='d']">
1637                                                 <city>
1638                                                         <xsl:call-template name="chopPunctuation">
1639                                                                 <xsl:with-param name="chopString" select="."/>
1640                                                         </xsl:call-template>
1641                                                 </city>
1642                                         </xsl:for-each>
1643                                         <xsl:for-each select="marc:subfield[@code='e']">
1644                                                 <citySection>
1645                                                         <xsl:call-template name="chopPunctuation">
1646                                                                 <xsl:with-param name="chopString" select="."/>
1647                                                         </xsl:call-template>
1648                                                 </citySection>
1649                                         </xsl:for-each>
1650                                         <xsl:for-each select="marc:subfield[@code='g']">
1651                                                 <region>
1652                                                         <xsl:call-template name="chopPunctuation">
1653                                                                 <xsl:with-param name="chopString" select="."/>
1654                                                         </xsl:call-template>
1655                                                 </region>
1656                                         </xsl:for-each>
1657                                         <xsl:for-each select="marc:subfield[@code='h']">
1658                                                 <extraterrestrialArea>
1659                                                         <xsl:call-template name="chopPunctuation">
1660                                                                 <xsl:with-param name="chopString" select="."/>
1661                                                         </xsl:call-template>
1662                                                 </extraterrestrialArea>
1663                                         </xsl:for-each>
1664                                 </hierarchicalGeographic>
1665                         </subject>
1666                 </xsl:for-each>
1667                 <xsl:for-each select="marc:datafield[@tag=045][marc:subfield[@code='b']]">
1668                         <subject>
1669                                 <xsl:choose>
1670                                         <xsl:when test="@ind1=2">
1671                                                 <temporal encoding="iso8601" point="start">
1672                                                         <xsl:call-template name="chopPunctuation">
1673                                                                 <xsl:with-param name="chopString">
1674                                                                         <xsl:value-of select="marc:subfield[@code='b'][1]"/>
1675                                                                 </xsl:with-param>
1676                                                         </xsl:call-template>
1677                                                 </temporal>
1678                                                 <temporal encoding="iso8601" point="end">
1679                                                         <xsl:call-template name="chopPunctuation">
1680                                                                 <xsl:with-param name="chopString">
1681                                                                         <xsl:value-of select="marc:subfield[@code='b'][2]"/>
1682                                                                 </xsl:with-param>
1683                                                         </xsl:call-template>
1684                                                 </temporal>
1685                                         </xsl:when>
1686                                         <xsl:otherwise>
1687                                                 <xsl:for-each select="marc:subfield[@code='b']">
1688                                                         <temporal encoding="iso8601">
1689                                                                 <xsl:call-template name="chopPunctuation">
1690                                                                         <xsl:with-param name="chopString" select="."/>
1691                                                                 </xsl:call-template>
1692                                                         </temporal>
1693                                                 </xsl:for-each>
1694                                         </xsl:otherwise>
1695                                 </xsl:choose>
1696                         </subject>
1697                 </xsl:for-each>
1698                 <xsl:for-each select="marc:datafield[@tag=050]">
1699                         <xsl:for-each select="marc:subfield[@code='b']">
1700                                 <classification authority="lcc">
1701                                         <xsl:if test="../marc:subfield[@code='3']">
1702                                                 <xsl:attribute name="displayLabel">
1703                                                         <xsl:value-of select="../marc:subfield[@code='3']"/>
1704                                                 </xsl:attribute>
1705                                         </xsl:if>
1706                                         <xsl:value-of select="preceding-sibling::marc:subfield[@code='a'][1]"/>
1707                                         <xsl:text> </xsl:text>
1708                                         <xsl:value-of select="text()"/>
1709                                 </classification>
1710                         </xsl:for-each>
1711                         <xsl:for-each
1712                                 select="marc:subfield[@code='a'][not(following-sibling::marc:subfield[@code='b'])]">
1713                                 <classification authority="lcc">
1714                                         <xsl:if test="../marc:subfield[@code='3']">
1715                                                 <xsl:attribute name="displayLabel">
1716                                                         <xsl:value-of select="../marc:subfield[@code='3']"/>
1717                                                 </xsl:attribute>
1718                                         </xsl:if>
1719                                         <xsl:value-of select="text()"/>
1720                                 </classification>
1721                         </xsl:for-each>
1722                 </xsl:for-each>
1723                 <xsl:for-each select="marc:datafield[@tag=082]">
1724                         <classification authority="ddc">
1725                                 <xsl:if test="marc:subfield[@code='2']">
1726                                         <xsl:attribute name="edition">
1727                                                 <xsl:value-of select="marc:subfield[@code='2']"/>
1728                                         </xsl:attribute>
1729                                 </xsl:if>
1730                                 <xsl:call-template name="subfieldSelect">
1731                                         <xsl:with-param name="codes">ab</xsl:with-param>
1732                                 </xsl:call-template>
1733                         </classification>
1734                 </xsl:for-each>
1735                 <xsl:for-each select="marc:datafield[@tag=080]">
1736                         <classification authority="udc">
1737                                 <xsl:call-template name="subfieldSelect">
1738                                         <xsl:with-param name="codes">abx</xsl:with-param>
1739                                 </xsl:call-template>
1740                         </classification>
1741                 </xsl:for-each>
1742                 <xsl:for-each select="marc:datafield[@tag=060]">
1743                         <classification authority="nlm">
1744                                 <xsl:call-template name="subfieldSelect">
1745                                         <xsl:with-param name="codes">ab</xsl:with-param>
1746                                 </xsl:call-template>
1747                         </classification>
1748                 </xsl:for-each>
1749                 <xsl:for-each select="marc:datafield[@tag=086][@ind1=0]">
1750                         <classification authority="sudocs">
1751                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1752                         </classification>
1753                 </xsl:for-each>
1754                 <xsl:for-each select="marc:datafield[@tag=086][@ind1=1]">
1755                         <classification authority="candoc">
1756                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1757                         </classification>
1758                 </xsl:for-each>
1759                 <xsl:for-each select="marc:datafield[@tag=086]">
1760                         <classification>
1761                                 <xsl:attribute name="authority">
1762                                         <xsl:value-of select="marc:subfield[@code='2']"/>
1763                                 </xsl:attribute>
1764                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1765                         </classification>
1766                 </xsl:for-each>
1767                 <xsl:for-each select="marc:datafield[@tag=084]">
1768                         <classification>
1769                                 <xsl:attribute name="authority">
1770                                         <xsl:value-of select="marc:subfield[@code='2']"/>
1771                                 </xsl:attribute>
1772                                 <xsl:call-template name="subfieldSelect">
1773                                         <xsl:with-param name="codes">ab</xsl:with-param>
1774                                 </xsl:call-template>
1775                         </classification>
1776                 </xsl:for-each>
1777                 <xsl:for-each select="marc:datafield[@tag=440]">
1778                         <relatedItem type="series">
1779                                 <titleInfo>
1780                                         <title>
1781                                                 <xsl:call-template name="chopPunctuation">
1782                                                         <xsl:with-param name="chopString">
1783                                                                 <xsl:call-template name="subfieldSelect">
1784                                                                         <xsl:with-param name="codes">av</xsl:with-param>
1785                                                                 </xsl:call-template>
1786                                                         </xsl:with-param>
1787                                                 </xsl:call-template>
1788                                         </title>
1789                                         <xsl:call-template name="part"/>
1790                                 </titleInfo>
1791                         </relatedItem>
1792                 </xsl:for-each>
1793                 <xsl:for-each select="marc:datafield[@tag=490][@ind1=0]">
1794                         <relatedItem type="series">
1795                                 <titleInfo>
1796                                         <title>
1797                                                 <xsl:call-template name="chopPunctuation">
1798                                                         <xsl:with-param name="chopString">
1799                                                                 <xsl:call-template name="subfieldSelect">
1800                                                                         <xsl:with-param name="codes">av</xsl:with-param>
1801                                                                 </xsl:call-template>
1802                                                         </xsl:with-param>
1803                                                 </xsl:call-template>
1804                                         </title>
1805                                         <xsl:call-template name="part"/>
1806                                 </titleInfo>
1807                         </relatedItem>
1808                 </xsl:for-each>
1809                 <xsl:for-each select="marc:datafield[@tag=510]">
1810                         <relatedItem type="isReferencedBy">
1811                                 <note>
1812                                         <xsl:call-template name="subfieldSelect">
1813                                                 <xsl:with-param name="codes">abcx3</xsl:with-param>
1814                                         </xsl:call-template>
1815                                 </note>
1816                         </relatedItem>
1817                 </xsl:for-each>
1818                 <xsl:for-each select="marc:datafield[@tag=534]">
1819                         <relatedItem type="original">
1820                                 <xsl:call-template name="relatedTitle"/>
1821                                 <xsl:call-template name="relatedName"/>
1822                                 <xsl:if test="marc:subfield[@code='b' or @code='c']">
1823                                         <originInfo>
1824                                                 <xsl:for-each select="marc:subfield[@code='c']">
1825                                                         <publisher>
1826                                                                 <xsl:value-of select="."/>
1827                                                         </publisher>
1828                                                 </xsl:for-each>
1829                                                 <xsl:for-each select="marc:subfield[@code='b']">
1830                                                         <edition>
1831                                                                 <xsl:value-of select="."/>
1832                                                         </edition>
1833                                                 </xsl:for-each>
1834                                         </originInfo>
1835                                 </xsl:if>
1836                                 <xsl:call-template name="relatedIdentifierISSN"/>
1837                                 <xsl:for-each select="marc:subfield[@code='z']">
1838                                         <identifier type="isbn">
1839                                                 <xsl:value-of select="."/>
1840                                         </identifier>
1841                                 </xsl:for-each>
1842                                 <xsl:call-template name="relatedNote"/>
1843                         </relatedItem>
1844                 </xsl:for-each>
1845                 <xsl:for-each select="marc:datafield[@tag=700][marc:subfield[@code='t']]">
1846                         <relatedItem>
1847                                 <xsl:call-template name="constituentOrRelatedType"/>
1848                                 <titleInfo>
1849                                         <title>
1850                                                 <xsl:call-template name="chopPunctuation">
1851                                                         <xsl:with-param name="chopString">
1852                                                                 <xsl:call-template name="specialSubfieldSelect">
1853                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1854                                                                         <xsl:with-param name="axis">t</xsl:with-param>
1855                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
1856                                                                 </xsl:call-template>
1857                                                         </xsl:with-param>
1858                                                 </xsl:call-template>
1859                                         </title>
1860                                         <xsl:call-template name="part"/>
1861                                 </titleInfo>
1862                                 <name type="personal">
1863                                         <namePart>
1864                                                 <xsl:call-template name="specialSubfieldSelect">
1865                                                         <xsl:with-param name="anyCodes">aq</xsl:with-param>
1866                                                         <xsl:with-param name="axis">t</xsl:with-param>
1867                                                         <xsl:with-param name="beforeCodes">g</xsl:with-param>
1868                                                 </xsl:call-template>
1869                                         </namePart>
1870                                         <xsl:call-template name="termsOfAddress"/>
1871                                         <xsl:call-template name="nameDate"/>
1872                                         <xsl:call-template name="role"/>
1873                                 </name>
1874                                 <xsl:call-template name="relatedForm"/>
1875                                 <xsl:call-template name="relatedIdentifierISSN"/>
1876                         </relatedItem>
1877                 </xsl:for-each>
1878                 <xsl:for-each select="marc:datafield[@tag=710][marc:subfield[@code='t']]">
1879                         <relatedItem>
1880                                 <xsl:call-template name="constituentOrRelatedType"/>
1881                                 <titleInfo>
1882                                         <title>
1883                                                 <xsl:call-template name="chopPunctuation">
1884                                                         <xsl:with-param name="chopString">
1885                                                                 <xsl:call-template name="specialSubfieldSelect">
1886                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
1887                                                                         <xsl:with-param name="axis">t</xsl:with-param>
1888                                                                         <xsl:with-param name="afterCodes">dg</xsl:with-param>
1889                                                                 </xsl:call-template>
1890                                                         </xsl:with-param>
1891                                                 </xsl:call-template>
1892                                         </title>
1893                                         <xsl:call-template name="relatedPartNumName"/>
1894                                 </titleInfo>
1895                                 <name type="corporate">
1896                                         <xsl:for-each select="marc:subfield[@code='a']">
1897                                                 <namePart>
1898                                                         <xsl:value-of select="."/>
1899                                                 </namePart>
1900                                         </xsl:for-each>
1901                                         <xsl:for-each select="marc:subfield[@code='b']">
1902                                                 <namePart>
1903                                                         <xsl:value-of select="."/>
1904                                                 </namePart>
1905                                         </xsl:for-each>
1906                                         <xsl:variable name="tempNamePart">
1907                                                 <xsl:call-template name="specialSubfieldSelect">
1908                                                         <xsl:with-param name="anyCodes">c</xsl:with-param>
1909                                                         <xsl:with-param name="axis">t</xsl:with-param>
1910                                                         <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
1911                                                 </xsl:call-template>
1912                                         </xsl:variable>
1913                                         <xsl:if test="normalize-space($tempNamePart)">
1914                                                 <namePart>
1915                                                         <xsl:value-of select="$tempNamePart"/>
1916                                                 </namePart>
1917                                         </xsl:if>
1918                                         <xsl:call-template name="role"/>
1919                                 </name>
1920                                 <xsl:call-template name="relatedForm"/>
1921                                 <xsl:call-template name="relatedIdentifierISSN"/>
1922                         </relatedItem>
1923                 </xsl:for-each>
1924                 <xsl:for-each select="marc:datafield[@tag=711][marc:subfield[@code='t']]">
1925                         <relatedItem>
1926                                 <xsl:call-template name="constituentOrRelatedType"/>
1927                                 <titleInfo>
1928                                         <title>
1929                                                 <xsl:call-template name="chopPunctuation">
1930                                                         <xsl:with-param name="chopString">
1931                                                                 <xsl:call-template name="specialSubfieldSelect">
1932                                                                         <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
1933                                                                         <xsl:with-param name="axis">t</xsl:with-param>
1934                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
1935                                                                 </xsl:call-template>
1936                                                         </xsl:with-param>
1937                                                 </xsl:call-template>
1938                                         </title>
1939                                         <xsl:call-template name="relatedPartNumName"/>
1940                                 </titleInfo>
1941                                 <name type="conference">
1942                                         <namePart>
1943                                                 <xsl:call-template name="specialSubfieldSelect">
1944                                                         <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
1945                                                         <xsl:with-param name="axis">t</xsl:with-param>
1946                                                         <xsl:with-param name="beforeCodes">gn</xsl:with-param>
1947                                                 </xsl:call-template>
1948                                         </namePart>
1949                                 </name>
1950                                 <xsl:call-template name="relatedForm"/>
1951                                 <xsl:call-template name="relatedIdentifierISSN"/>
1952                         </relatedItem>
1953                 </xsl:for-each>
1954                 <xsl:for-each select="marc:datafield[@tag=730][@ind2=2]">
1955                         <relatedItem>
1956                                 <xsl:call-template name="constituentOrRelatedType"/>
1957                                 <titleInfo>
1958                                         <title>
1959                                                 <xsl:call-template name="chopPunctuation">
1960                                                         <xsl:with-param name="chopString">
1961                                                                 <xsl:call-template name="subfieldSelect">
1962                                                                         <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
1963                                                                 </xsl:call-template>
1964                                                         </xsl:with-param>
1965                                                 </xsl:call-template>
1966                                         </title>
1967                                         <xsl:call-template name="part"/>
1968                                 </titleInfo>
1969                                 <xsl:call-template name="relatedForm"/>
1970                                 <xsl:call-template name="relatedIdentifierISSN"/>
1971                         </relatedItem>
1972                 </xsl:for-each>
1973                 <xsl:for-each select="marc:datafield[@tag=740][@ind2=2]">
1974                         <relatedItem>
1975                                 <xsl:call-template name="constituentOrRelatedType"/>
1976                                 <titleInfo>
1977                                         <title>
1978                                                 <xsl:call-template name="chopPunctuation">
1979                                                         <xsl:with-param name="chopString">
1980                                                                 <xsl:value-of select="marc:subfield[@code='a']"/>
1981                                                         </xsl:with-param>
1982                                                 </xsl:call-template>
1983                                         </title>
1984                                         <xsl:call-template name="part"/>
1985                                 </titleInfo>
1986                                 <xsl:call-template name="relatedForm"/>
1987                         </relatedItem>
1988                 </xsl:for-each>
1989                 <xsl:for-each select="marc:datafield[@tag=760]|marc:datafield[@tag=762]">
1990                         <relatedItem type="series">
1991                                 <xsl:call-template name="relatedItem76X-78X"/>
1992                         </relatedItem>
1993                 </xsl:for-each>
1994                 <xsl:for-each
1995                         select="marc:datafield[@tag=765]|marc:datafield[@tag=767]|marc:datafield[@tag=777]|marc:datafield[@tag=787]">
1996                         <relatedItem>
1997                                 <xsl:call-template name="relatedItem76X-78X"/>
1998                         </relatedItem>
1999                 </xsl:for-each>
2000                 <xsl:for-each select="marc:datafield[@tag=775]">
2001                         <relatedItem type="otherVersion">
2002                                 <xsl:call-template name="relatedItem76X-78X"/>
2003                         </relatedItem>
2004                 </xsl:for-each>
2005                 <xsl:for-each select="marc:datafield[@tag=770]|marc:datafield[@tag=774]">
2006                         <relatedItem type="constituent">
2007                                 <xsl:call-template name="relatedItem76X-78X"/>
2008                         </relatedItem>
2009                 </xsl:for-each>
2010                 <xsl:for-each select="marc:datafield[@tag=772]|marc:datafield[@tag=773]">
2011                         <relatedItem type="host">
2012                                 <xsl:call-template name="relatedItem76X-78X"/>
2013                         </relatedItem>
2014                 </xsl:for-each>
2015                 <xsl:for-each select="marc:datafield[@tag=776]">
2016                         <relatedItem type="otherFormat">
2017                                 <xsl:call-template name="relatedItem76X-78X"/>
2018                         </relatedItem>
2019                 </xsl:for-each>
2020                 <xsl:for-each select="marc:datafield[@tag=780]">
2021                         <relatedItem type="preceding">
2022                                 <xsl:call-template name="relatedItem76X-78X"/>
2023                         </relatedItem>
2024                 </xsl:for-each>
2025                 <xsl:for-each select="marc:datafield[@tag=785]">
2026                         <relatedItem type="succeeding">
2027                                 <xsl:call-template name="relatedItem76X-78X"/>
2028                         </relatedItem>
2029                 </xsl:for-each>
2030                 <xsl:for-each select="marc:datafield[@tag=786]">
2031                         <relatedItem type="original">
2032                                 <xsl:call-template name="relatedItem76X-78X"/>
2033                         </relatedItem>
2034                 </xsl:for-each>
2035                 <xsl:for-each select="marc:datafield[@tag=800]">
2036                         <relatedItem type="series">
2037                                 <titleInfo>
2038                                         <title>
2039                                                 <xsl:call-template name="chopPunctuation">
2040                                                         <xsl:with-param name="chopString">
2041                                                                 <xsl:call-template name="specialSubfieldSelect">
2042                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2043                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2044                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
2045                                                                 </xsl:call-template>
2046                                                         </xsl:with-param>
2047                                                 </xsl:call-template>
2048                                         </title>
2049                                         <xsl:call-template name="part"/>
2050                                 </titleInfo>
2051                                 <name type="personal">
2052                                         <namePart>
2053                                                 <xsl:call-template name="chopPunctuation">
2054                                                         <xsl:with-param name="chopString">
2055                                                                 <xsl:call-template name="specialSubfieldSelect">
2056                                                                         <xsl:with-param name="anyCodes">aq</xsl:with-param>
2057                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2058                                                                         <xsl:with-param name="beforeCodes">g</xsl:with-param>
2059                                                                 </xsl:call-template>
2060                                                         </xsl:with-param>
2061                                                 </xsl:call-template>
2062                                         </namePart>
2063                                         <xsl:call-template name="termsOfAddress"/>
2064                                         <xsl:call-template name="nameDate"/>
2065                                         <xsl:call-template name="role"/>
2066                                 </name>
2067                                 <xsl:call-template name="relatedForm"/>
2068                         </relatedItem>
2069                 </xsl:for-each>
2070                 <xsl:for-each select="marc:datafield[@tag=810]">
2071                         <relatedItem type="series">
2072                                 <titleInfo>
2073                                         <title>
2074                                                 <xsl:call-template name="chopPunctuation">
2075                                                         <xsl:with-param name="chopString">
2076                                                                 <xsl:call-template name="specialSubfieldSelect">
2077                                                                         <xsl:with-param name="anyCodes">tfklmorsv</xsl:with-param>
2078                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2079                                                                         <xsl:with-param name="afterCodes">dg</xsl:with-param>
2080                                                                 </xsl:call-template>
2081                                                         </xsl:with-param>
2082                                                 </xsl:call-template>
2083                                         </title>
2084                                         <xsl:call-template name="relatedPartNumName"/>
2085                                 </titleInfo>
2086                                 <name type="corporate">
2087                                         <xsl:for-each select="marc:subfield[@code='a']">
2088                                                 <namePart>
2089                                                         <xsl:value-of select="."/>
2090                                                 </namePart>
2091                                         </xsl:for-each>
2092                                         <xsl:for-each select="marc:subfield[@code='b']">
2093                                                 <namePart>
2094                                                         <xsl:value-of select="."/>
2095                                                 </namePart>
2096                                         </xsl:for-each>
2097                                         <namePart>
2098                                                 <xsl:call-template name="specialSubfieldSelect">
2099                                                         <xsl:with-param name="anyCodes">c</xsl:with-param>
2100                                                         <xsl:with-param name="axis">t</xsl:with-param>
2101                                                         <xsl:with-param name="beforeCodes">dgn</xsl:with-param>
2102                                                 </xsl:call-template>
2103                                         </namePart>
2104                                         <xsl:call-template name="role"/>
2105                                 </name>
2106                                 <xsl:call-template name="relatedForm"/>
2107                         </relatedItem>
2108                 </xsl:for-each>
2109                 <xsl:for-each select="marc:datafield[@tag=811]">
2110                         <relatedItem type="series">
2111                                 <titleInfo>
2112                                         <title>
2113                                                 <xsl:call-template name="chopPunctuation">
2114                                                         <xsl:with-param name="chopString">
2115                                                                 <xsl:call-template name="specialSubfieldSelect">
2116                                                                         <xsl:with-param name="anyCodes">tfklsv</xsl:with-param>
2117                                                                         <xsl:with-param name="axis">t</xsl:with-param>
2118                                                                         <xsl:with-param name="afterCodes">g</xsl:with-param>
2119                                                                 </xsl:call-template>
2120                                                         </xsl:with-param>
2121                                                 </xsl:call-template>
2122                                         </title>
2123                                         <xsl:call-template name="relatedPartNumName"/>
2124                                 </titleInfo>
2125                                 <name type="conference">
2126                                         <namePart>
2127                                                 <xsl:call-template name="specialSubfieldSelect">
2128                                                         <xsl:with-param name="anyCodes">aqdc</xsl:with-param>
2129                                                         <xsl:with-param name="axis">t</xsl:with-param>
2130                                                         <xsl:with-param name="beforeCodes">gn</xsl:with-param>
2131                                                 </xsl:call-template>
2132                                         </namePart>
2133                                         <xsl:call-template name="role"/>
2134                                 </name>
2135                                 <xsl:call-template name="relatedForm"/>
2136                         </relatedItem>
2137                 </xsl:for-each>
2138                 <xsl:for-each select="marc:datafield[@tag='830']">
2139                         <relatedItem type="series">
2140                                 <titleInfo>
2141                                         <title>
2142                                                 <xsl:call-template name="chopPunctuation">
2143                                                         <xsl:with-param name="chopString">
2144                                                                 <xsl:call-template name="subfieldSelect">
2145                                                                         <xsl:with-param name="codes">adfgklmorsv</xsl:with-param>
2146                                                                 </xsl:call-template>
2147                                                         </xsl:with-param>
2148                                                 </xsl:call-template>
2149                                         </title>
2150                                         <xsl:call-template name="part"/>
2151                                 </titleInfo>
2152                                 <xsl:call-template name="relatedForm"/>
2153                         </relatedItem>
2154                 </xsl:for-each>
2155                 <xsl:for-each select="marc:datafield[@tag='856'][@ind2='2']/marc:subfield[@code='q']">
2156                         <relatedItem>
2157                                 <internetMediaType>
2158                                         <xsl:value-of select="."/>
2159                                 </internetMediaType>
2160                         </relatedItem>
2161                 </xsl:for-each>
2162                 <xsl:for-each select="marc:datafield[@tag='020']">
2163                         <xsl:call-template name="isInvalid">
2164                                 <xsl:with-param name="type">isbn</xsl:with-param>
2165                         </xsl:call-template>
2166                         <xsl:if test="marc:subfield[@code='a']">
2167                                 <identifier type="isbn">
2168                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2169                                 </identifier>
2170                         </xsl:if>
2171                 </xsl:for-each>
2172                 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='0']">
2173                         <xsl:call-template name="isInvalid">
2174                                 <xsl:with-param name="type">isrc</xsl:with-param>
2175                         </xsl:call-template>
2176                         <xsl:if test="marc:subfield[@code='a']">
2177                                 <identifier type="isrc">
2178                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2179                                 </identifier>
2180                         </xsl:if>
2181                 </xsl:for-each>
2182                 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='2']">
2183                         <xsl:call-template name="isInvalid">
2184                                 <xsl:with-param name="type">ismn</xsl:with-param>
2185                         </xsl:call-template>
2186                         <xsl:if test="marc:subfield[@code='a']">
2187                                 <identifier type="ismn">
2188                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2189                                 </identifier>
2190                         </xsl:if>
2191                 </xsl:for-each>
2192                 <xsl:for-each select="marc:datafield[@tag='024'][@ind1='4']">
2193                         <xsl:call-template name="isInvalid">
2194                                 <xsl:with-param name="type">sici</xsl:with-param>
2195                         </xsl:call-template>
2196                         <identifier type="sici">
2197                                 <xsl:call-template name="subfieldSelect">
2198                                         <xsl:with-param name="codes">ab</xsl:with-param>
2199                                 </xsl:call-template>
2200                         </identifier>
2201                 </xsl:for-each>
2202                 <xsl:for-each select="marc:datafield[@tag='022']">
2203                         <xsl:if test="marc:subfield[@code='a']">
2204                                 <xsl:call-template name="isInvalid">
2205                                         <xsl:with-param name="type">issn</xsl:with-param>
2206                                 </xsl:call-template>
2207                                 <identifier type="issn">
2208                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2209                                 </identifier>
2210                         </xsl:if>
2211                         <xsl:if test="marc:subfield[@code='l']">
2212                                 <xsl:call-template name="isInvalid">
2213                                         <xsl:with-param name="type">issn-l</xsl:with-param>
2214                                 </xsl:call-template>
2215                                 <identifier type="issn-l">
2216                                         <xsl:value-of select="marc:subfield[@code='l']"/>
2217                                 </identifier>
2218                         </xsl:if>
2219                 </xsl:for-each>
2220
2221
2222
2223                 <xsl:for-each select="marc:datafield[@tag='010']">
2224                         <xsl:call-template name="isInvalid">
2225                                 <xsl:with-param name="type">lccn</xsl:with-param>
2226                         </xsl:call-template>
2227                         <identifier type="lccn">
2228                                 <xsl:value-of select="normalize-space(marc:subfield[@code='a'])"/>
2229                         </identifier>
2230                 </xsl:for-each>
2231                 <xsl:for-each select="marc:datafield[@tag='028']">
2232                         <identifier>
2233                                 <xsl:attribute name="type">
2234                                         <xsl:choose>
2235                                                 <xsl:when test="@ind1='0'">issue number</xsl:when>
2236                                                 <xsl:when test="@ind1='1'">matrix number</xsl:when>
2237                                                 <xsl:when test="@ind1='2'">music plate</xsl:when>
2238                                                 <xsl:when test="@ind1='3'">music publisher</xsl:when>
2239                                                 <xsl:when test="@ind1='4'">videorecording identifier</xsl:when>
2240                                         </xsl:choose>
2241                                 </xsl:attribute>
2242                                 <!--<xsl:call-template name="isInvalid"/>-->
2243                                 <!-- no $z in 028 -->
2244                                 <xsl:call-template name="subfieldSelect">
2245                                         <xsl:with-param name="codes">
2246                                                 <xsl:choose>
2247                                                         <xsl:when test="@ind1='0'">ba</xsl:when>
2248                                                         <xsl:otherwise>ab</xsl:otherwise>
2249                                                 </xsl:choose>
2250                                         </xsl:with-param>
2251                                 </xsl:call-template>
2252                         </identifier>
2253                 </xsl:for-each>
2254                 <xsl:for-each select="marc:datafield[@tag='037']">
2255                         <identifier type="stock number">
2256                                 <!--<xsl:call-template name="isInvalid"/>-->
2257                                 <!-- no $z in 037 -->
2258                                 <xsl:call-template name="subfieldSelect">
2259                                         <xsl:with-param name="codes">ab</xsl:with-param>
2260                                 </xsl:call-template>
2261                         </identifier>
2262                 </xsl:for-each>
2263                 <xsl:for-each select="marc:datafield[@tag='856'][marc:subfield[@code='u']]">
2264                         <identifier>
2265                                 <xsl:attribute name="type">
2266                                         <xsl:choose>
2267                                                 <xsl:when
2268                                                         test="starts-with(marc:subfield[@code='u'],'urn:doi') or starts-with(marc:subfield[@code='u'],'doi')"
2269                                                         >doi</xsl:when>
2270                                                 <xsl:when
2271                                                         test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov')"
2272                                                         >hdl</xsl:when>
2273                                                 <xsl:otherwise>uri</xsl:otherwise>
2274                                         </xsl:choose>
2275                                 </xsl:attribute>
2276                                 <xsl:choose>
2277                                         <xsl:when
2278                                                 test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl') or starts-with(marc:subfield[@code='u'],'http://hdl.loc.gov') ">
2279                                                 <xsl:value-of
2280                                                         select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"
2281                                                 />
2282                                         </xsl:when>
2283                                         <xsl:otherwise>
2284                                                 <xsl:value-of select="marc:subfield[@code='u']"/>
2285                                         </xsl:otherwise>
2286                                 </xsl:choose>
2287                         </identifier>
2288                         <xsl:if
2289                                 test="starts-with(marc:subfield[@code='u'],'urn:hdl') or starts-with(marc:subfield[@code='u'],'hdl')">
2290                                 <identifier type="hdl">
2291                                         <xsl:if test="marc:subfield[@code='y' or @code='3' or @code='z']">
2292                                                 <xsl:attribute name="displayLabel">
2293                                                         <xsl:call-template name="subfieldSelect">
2294                                                                 <xsl:with-param name="codes">y3z</xsl:with-param>
2295                                                         </xsl:call-template>
2296                                                 </xsl:attribute>
2297                                         </xsl:if>
2298                                         <xsl:value-of
2299                                                 select="concat('hdl:',substring-after(marc:subfield[@code='u'],'http://hdl.loc.gov/'))"
2300                                         />
2301                                 </identifier>
2302                         </xsl:if>
2303                 </xsl:for-each>
2304                 <xsl:for-each select="marc:datafield[@tag=024][@ind1=1]">
2305                         <identifier type="upc">
2306                                 <xsl:call-template name="isInvalid"/>
2307                                 <xsl:value-of select="marc:subfield[@code='a']"/>
2308                         </identifier>
2309                 </xsl:for-each>
2310
2311                 <!-- 1/04 fix added $y -->
2312
2313                 <!-- 1.21  tmee-->
2314                 <xsl:for-each select="marc:datafield[@tag=856][@ind2=1][marc:subfield[@code='u']]">
2315                         <relatedItem type="otherVersion">
2316                                 <location>
2317                                         <url>
2318                                                 <xsl:if test="marc:subfield[@code='y' or @code='3']">
2319                                                         <xsl:attribute name="displayLabel">
2320                                                                 <xsl:call-template name="subfieldSelect">
2321                                                                         <xsl:with-param name="codes">y3</xsl:with-param>
2322                                                                 </xsl:call-template>
2323                                                         </xsl:attribute>
2324                                                 </xsl:if>
2325                                                 <xsl:if test="marc:subfield[@code='z' ]">
2326                                                         <xsl:attribute name="note">
2327                                                                 <xsl:call-template name="subfieldSelect">
2328                                                                         <xsl:with-param name="codes">z</xsl:with-param>
2329                                                                 </xsl:call-template>
2330                                                         </xsl:attribute>
2331                                                 </xsl:if>
2332                                                 <xsl:value-of select="marc:subfield[@code='u']"/>
2333                                         </url>
2334                                 </location>
2335                         </relatedItem>
2336                 </xsl:for-each>
2337                 <xsl:for-each select="marc:datafield[@tag=856][@ind2=2][marc:subfield[@code='u']]">
2338                         <relatedItem>
2339                                 <location>
2340                                         <url>
2341                                                 <xsl:if test="marc:subfield[@code='y' or @code='3']">
2342                                                         <xsl:attribute name="displayLabel">
2343                                                                 <xsl:call-template name="subfieldSelect">
2344                                                                         <xsl:with-param name="codes">y3</xsl:with-param>
2345                                                                 </xsl:call-template>
2346                                                         </xsl:attribute>
2347                                                 </xsl:if>
2348                                                 <xsl:if test="marc:subfield[@code='z' ]">
2349                                                         <xsl:attribute name="note">
2350                                                                 <xsl:call-template name="subfieldSelect">
2351                                                                         <xsl:with-param name="codes">z</xsl:with-param>
2352                                                                 </xsl:call-template>
2353                                                         </xsl:attribute>
2354                                                 </xsl:if>
2355                                                 <xsl:value-of select="marc:subfield[@code='u']"/>
2356                                         </url>
2357                                 </location>
2358                         </relatedItem>
2359                 </xsl:for-each>
2360
2361                 <!-- 3.2 change tmee 856z  -->
2362
2363                 <!-- 1.24  tmee  -->
2364                 <xsl:for-each select="marc:datafield[@tag=852]">
2365                         <location>
2366                                 <xsl:if test="marc:subfield[@code='a' or @code='b' or @code='e']">
2367                                         <physicalLocation>
2368                                                 <xsl:call-template name="subfieldSelect">
2369                                                         <xsl:with-param name="codes">abe</xsl:with-param>
2370                                                 </xsl:call-template>
2371                                         </physicalLocation>
2372                                 </xsl:if>
2373
2374                                 <xsl:if test="marc:subfield[@code='u']">
2375                                         <physicalLocation>
2376                                                 <xsl:call-template name="uri"/>
2377                                                 <xsl:call-template name="subfieldSelect">
2378                                                         <xsl:with-param name="codes">u</xsl:with-param>
2379                                                 </xsl:call-template>
2380                                         </physicalLocation>
2381                                 </xsl:if>
2382
2383                                 <xsl:if
2384                                         test="marc:subfield[@code='h' or @code='i' or @code='j' or @code='k' or @code='l' or @code='m' or @code='t']">
2385                                         <shelfLocation>
2386                                                 <xsl:call-template name="subfieldSelect">
2387                                                         <xsl:with-param name="codes">hijklmt</xsl:with-param>
2388                                                 </xsl:call-template>
2389                                         </shelfLocation>
2390                                 </xsl:if>
2391                         </location>
2392                 </xsl:for-each>
2393
2394                 <xsl:for-each select="marc:datafield[@tag=506]">
2395                         <accessCondition type="restrictionOnAccess">
2396                                 <xsl:call-template name="subfieldSelect">
2397                                         <xsl:with-param name="codes">abcd35</xsl:with-param>
2398                                 </xsl:call-template>
2399                         </accessCondition>
2400                 </xsl:for-each>
2401                 <xsl:for-each select="marc:datafield[@tag=540]">
2402                         <accessCondition type="useAndReproduction">
2403                                 <xsl:call-template name="subfieldSelect">
2404                                         <xsl:with-param name="codes">abcde35</xsl:with-param>
2405                                 </xsl:call-template>
2406                         </accessCondition>
2407                 </xsl:for-each>
2408
2409                 <recordInfo>
2410                         <!-- 1.25  tmee-->
2411
2412
2413                         <xsl:for-each select="marc:leader[substring($leader,19,1)='a']">
2414                                 <descriptionStandard>aacr2</descriptionStandard>
2415                         </xsl:for-each>
2416
2417                         <xsl:for-each select="marc:datafield[@tag=040]">
2418                                 <xsl:if test="marc:subfield[@code='e']">
2419                                         <descriptionStandard>
2420                                                 <xsl:value-of select="marc:subfield[@code='e']"/>
2421                                         </descriptionStandard>
2422                                 </xsl:if>
2423                                 <recordContentSource authority="marcorg">
2424                                         <xsl:value-of select="marc:subfield[@code='a']"/>
2425                                 </recordContentSource>
2426                         </xsl:for-each>
2427                         <xsl:for-each select="marc:controlfield[@tag=008]">
2428                                 <recordCreationDate encoding="marc">
2429                                         <xsl:value-of select="substring(.,1,6)"/>
2430                                 </recordCreationDate>
2431                         </xsl:for-each>
2432
2433                         <xsl:for-each select="marc:controlfield[@tag=005]">
2434                                 <recordChangeDate encoding="iso8601">
2435                                         <xsl:value-of select="."/>
2436                                 </recordChangeDate>
2437                         </xsl:for-each>
2438                         <xsl:for-each select="marc:controlfield[@tag=001]">
2439                                 <recordIdentifier>
2440                                         <xsl:if test="../marc:controlfield[@tag=003]">
2441                                                 <xsl:attribute name="source">
2442                                                         <xsl:value-of select="../marc:controlfield[@tag=003]"/>
2443                                                 </xsl:attribute>
2444                                         </xsl:if>
2445                                         <xsl:value-of select="."/>
2446                                 </recordIdentifier>
2447                         </xsl:for-each>
2448                         <xsl:for-each select="marc:datafield[@tag=040]/marc:subfield[@code='b']">
2449                                 <languageOfCataloging>
2450                                         <languageTerm authority="iso639-2b" type="code">
2451                                                 <xsl:value-of select="."/>
2452                                         </languageTerm>
2453                                 </languageOfCataloging>
2454                         </xsl:for-each>
2455                 </recordInfo>
2456         </xsl:template>
2457         <xsl:template name="displayForm">
2458                 <xsl:for-each select="marc:subfield[@code='c']">
2459                         <displayForm>
2460                                 <xsl:value-of select="."/>
2461                         </displayForm>
2462                 </xsl:for-each>
2463         </xsl:template>
2464         <xsl:template name="affiliation">
2465                 <xsl:for-each select="marc:subfield[@code='u']">
2466                         <affiliation>
2467                                 <xsl:value-of select="."/>
2468                         </affiliation>
2469                 </xsl:for-each>
2470         </xsl:template>
2471         <xsl:template name="uri">
2472                 <xsl:for-each select="marc:subfield[@code='u']">
2473                         <xsl:attribute name="xlink:href">
2474                                 <xsl:value-of select="."/>
2475                         </xsl:attribute>
2476                 </xsl:for-each>
2477                 <xsl:for-each select="marc:subfield[@code='0']">
2478                         <xsl:choose>
2479                                 <xsl:when test="contains(text(), ')')">
2480                                         <xsl:attribute name="xlink:href">
2481                                                 <xsl:value-of select="substring-after(text(), ')')"></xsl:value-of>
2482                                         </xsl:attribute>
2483                                 </xsl:when>
2484                                 <xsl:otherwise>
2485                                         <xsl:attribute name="xlink:href">
2486                                                 <xsl:value-of select="."></xsl:value-of>
2487                                         </xsl:attribute>
2488                                 </xsl:otherwise>
2489                         </xsl:choose>
2490                 </xsl:for-each>
2491         </xsl:template>
2492         <xsl:template name="role">
2493                 <xsl:for-each select="marc:subfield[@code='e']">
2494                         <role>
2495                                 <roleTerm type="text">
2496                                         <xsl:value-of select="."/>
2497                                 </roleTerm>
2498                         </role>
2499                 </xsl:for-each>
2500                 <xsl:for-each select="marc:subfield[@code='4']">
2501                         <role>
2502                                 <roleTerm authority="marcrelator" type="code">
2503                                         <xsl:value-of select="."/>
2504                                 </roleTerm>
2505                         </role>
2506                 </xsl:for-each>
2507         </xsl:template>
2508         <xsl:template name="part">
2509                 <xsl:variable name="partNumber">
2510                         <xsl:call-template name="specialSubfieldSelect">
2511                                 <xsl:with-param name="axis">n</xsl:with-param>
2512                                 <xsl:with-param name="anyCodes">n</xsl:with-param>
2513                                 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2514                         </xsl:call-template>
2515                 </xsl:variable>
2516                 <xsl:variable name="partName">
2517                         <xsl:call-template name="specialSubfieldSelect">
2518                                 <xsl:with-param name="axis">p</xsl:with-param>
2519                                 <xsl:with-param name="anyCodes">p</xsl:with-param>
2520                                 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2521                         </xsl:call-template>
2522                 </xsl:variable>
2523                 <xsl:if test="string-length(normalize-space($partNumber))">
2524                         <partNumber>
2525                                 <xsl:call-template name="chopPunctuation">
2526                                         <xsl:with-param name="chopString" select="$partNumber"/>
2527                                 </xsl:call-template>
2528                         </partNumber>
2529                 </xsl:if>
2530                 <xsl:if test="string-length(normalize-space($partName))">
2531                         <partName>
2532                                 <xsl:call-template name="chopPunctuation">
2533                                         <xsl:with-param name="chopString" select="$partName"/>
2534                                 </xsl:call-template>
2535                         </partName>
2536                 </xsl:if>
2537         </xsl:template>
2538         <xsl:template name="relatedPart">
2539                 <xsl:if test="@tag=773">
2540                         <xsl:for-each select="marc:subfield[@code='g']">
2541                                 <part>
2542                                         <text>
2543                                                 <xsl:value-of select="."/>
2544                                         </text>
2545                                 </part>
2546                         </xsl:for-each>
2547                         <xsl:for-each select="marc:subfield[@code='q']">
2548                                 <part>
2549                                         <xsl:call-template name="parsePart"/>
2550                                 </part>
2551                         </xsl:for-each>
2552                 </xsl:if>
2553         </xsl:template>
2554         <xsl:template name="relatedPartNumName">
2555                 <xsl:variable name="partNumber">
2556                         <xsl:call-template name="specialSubfieldSelect">
2557                                 <xsl:with-param name="axis">g</xsl:with-param>
2558                                 <xsl:with-param name="anyCodes">g</xsl:with-param>
2559                                 <xsl:with-param name="afterCodes">pst</xsl:with-param>
2560                         </xsl:call-template>
2561                 </xsl:variable>
2562                 <xsl:variable name="partName">
2563                         <xsl:call-template name="specialSubfieldSelect">
2564                                 <xsl:with-param name="axis">p</xsl:with-param>
2565                                 <xsl:with-param name="anyCodes">p</xsl:with-param>
2566                                 <xsl:with-param name="afterCodes">fgkdlmor</xsl:with-param>
2567                         </xsl:call-template>
2568                 </xsl:variable>
2569                 <xsl:if test="string-length(normalize-space($partNumber))">
2570                         <partNumber>
2571                                 <xsl:value-of select="$partNumber"/>
2572                         </partNumber>
2573                 </xsl:if>
2574                 <xsl:if test="string-length(normalize-space($partName))">
2575                         <partName>
2576                                 <xsl:value-of select="$partName"/>
2577                         </partName>
2578                 </xsl:if>
2579         </xsl:template>
2580         <xsl:template name="relatedName">
2581                 <xsl:for-each select="marc:subfield[@code='a']">
2582                         <name>
2583                                 <namePart>
2584                                         <xsl:value-of select="."/>
2585                                 </namePart>
2586                         </name>
2587                 </xsl:for-each>
2588         </xsl:template>
2589         <xsl:template name="relatedForm">
2590                 <xsl:for-each select="marc:subfield[@code='h']">
2591                         <physicalDescription>
2592                                 <form>
2593                                         <xsl:value-of select="."/>
2594                                 </form>
2595                         </physicalDescription>
2596                 </xsl:for-each>
2597         </xsl:template>
2598         <xsl:template name="relatedExtent">
2599                 <xsl:for-each select="marc:subfield[@code='h']">
2600                         <physicalDescription>
2601                                 <extent>
2602                                         <xsl:value-of select="."/>
2603                                 </extent>
2604                         </physicalDescription>
2605                 </xsl:for-each>
2606         </xsl:template>
2607         <xsl:template name="relatedNote">
2608                 <xsl:for-each select="marc:subfield[@code='n']">
2609                         <note>
2610                                 <xsl:value-of select="."/>
2611                         </note>
2612                 </xsl:for-each>
2613         </xsl:template>
2614         <xsl:template name="relatedSubject">
2615                 <xsl:for-each select="marc:subfield[@code='j']">
2616                         <subject>
2617                                 <temporal encoding="iso8601">
2618                                         <xsl:call-template name="chopPunctuation">
2619                                                 <xsl:with-param name="chopString" select="."/>
2620                                         </xsl:call-template>
2621                                 </temporal>
2622                         </subject>
2623                 </xsl:for-each>
2624         </xsl:template>
2625         <xsl:template name="relatedIdentifierISSN">
2626                 <xsl:for-each select="marc:subfield[@code='x']">
2627                         <identifier type="issn">
2628                                 <xsl:value-of select="."/>
2629                         </identifier>
2630                 </xsl:for-each>
2631         </xsl:template>
2632         <xsl:template name="relatedIdentifierLocal">
2633                 <xsl:for-each select="marc:subfield[@code='w']">
2634                         <identifier type="local">
2635                                 <xsl:value-of select="."/>
2636                         </identifier>
2637                 </xsl:for-each>
2638         </xsl:template>
2639         <xsl:template name="relatedIdentifier">
2640                 <xsl:for-each select="marc:subfield[@code='o']">
2641                         <identifier>
2642                                 <xsl:value-of select="."/>
2643                         </identifier>
2644                 </xsl:for-each>
2645         </xsl:template>
2646         <xsl:template name="relatedItem76X-78X">
2647                 <xsl:call-template name="displayLabel"/>
2648                 <xsl:call-template name="relatedTitle76X-78X"/>
2649                 <xsl:call-template name="relatedName"/>
2650                 <xsl:call-template name="relatedOriginInfo"/>
2651                 <xsl:call-template name="relatedLanguage"/>
2652                 <xsl:call-template name="relatedExtent"/>
2653                 <xsl:call-template name="relatedNote"/>
2654                 <xsl:call-template name="relatedSubject"/>
2655                 <xsl:call-template name="relatedIdentifier"/>
2656                 <xsl:call-template name="relatedIdentifierISSN"/>
2657                 <xsl:call-template name="relatedIdentifierLocal"/>
2658                 <xsl:call-template name="relatedPart"/>
2659         </xsl:template>
2660         <xsl:template name="subjectGeographicZ">
2661                 <geographic>
2662                         <xsl:call-template name="chopPunctuation">
2663                                 <xsl:with-param name="chopString" select="."/>
2664                         </xsl:call-template>
2665                 </geographic>
2666         </xsl:template>
2667         <xsl:template name="subjectTemporalY">
2668                 <temporal>
2669                         <xsl:call-template name="chopPunctuation">
2670                                 <xsl:with-param name="chopString" select="."/>
2671                         </xsl:call-template>
2672                 </temporal>
2673         </xsl:template>
2674         <xsl:template name="subjectTopic">
2675                 <topic>
2676                         <xsl:call-template name="chopPunctuation">
2677                                 <xsl:with-param name="chopString" select="."/>
2678                         </xsl:call-template>
2679                 </topic>
2680         </xsl:template>
2681         <!-- 3.2 change tmee 6xx $v genre -->
2682         <xsl:template name="subjectGenre">
2683                 <genre>
2684                         <xsl:call-template name="chopPunctuation">
2685                                 <xsl:with-param name="chopString" select="."/>
2686                         </xsl:call-template>
2687                 </genre>
2688         </xsl:template>
2689
2690         <xsl:template name="nameABCDN">
2691                 <xsl:for-each select="marc:subfield[@code='a']">
2692                         <namePart>
2693                                 <xsl:call-template name="chopPunctuation">
2694                                         <xsl:with-param name="chopString" select="."/>
2695                                 </xsl:call-template>
2696                         </namePart>
2697                 </xsl:for-each>
2698                 <xsl:for-each select="marc:subfield[@code='b']">
2699                         <namePart>
2700                                 <xsl:value-of select="."/>
2701                         </namePart>
2702                 </xsl:for-each>
2703                 <xsl:if
2704                         test="marc:subfield[@code='c'] or marc:subfield[@code='d'] or marc:subfield[@code='n']">
2705                         <namePart>
2706                                 <xsl:call-template name="subfieldSelect">
2707                                         <xsl:with-param name="codes">cdn</xsl:with-param>
2708                                 </xsl:call-template>
2709                         </namePart>
2710                 </xsl:if>
2711         </xsl:template>
2712         <xsl:template name="nameABCDQ">
2713                 <namePart>
2714                         <xsl:call-template name="chopPunctuation">
2715                                 <xsl:with-param name="chopString">
2716                                         <xsl:call-template name="subfieldSelect">
2717                                                 <xsl:with-param name="codes">aq</xsl:with-param>
2718                                         </xsl:call-template>
2719                                 </xsl:with-param>
2720                                 <xsl:with-param name="punctuation">
2721                                         <xsl:text>:,;/ </xsl:text>
2722                                 </xsl:with-param>
2723                         </xsl:call-template>
2724                 </namePart>
2725                 <xsl:call-template name="termsOfAddress"/>
2726                 <xsl:call-template name="nameDate"/>
2727         </xsl:template>
2728         <xsl:template name="nameACDEQ">
2729                 <namePart>
2730                         <xsl:call-template name="subfieldSelect">
2731                                 <xsl:with-param name="codes">acdeq</xsl:with-param>
2732                         </xsl:call-template>
2733                 </namePart>
2734         </xsl:template>
2735         <xsl:template name="constituentOrRelatedType">
2736                 <xsl:if test="@ind2=2">
2737                         <xsl:attribute name="type">constituent</xsl:attribute>
2738                 </xsl:if>
2739         </xsl:template>
2740         <xsl:template name="relatedTitle">
2741                 <xsl:for-each select="marc:subfield[@code='t']">
2742                         <titleInfo>
2743                                 <title>
2744                                         <xsl:call-template name="chopPunctuation">
2745                                                 <xsl:with-param name="chopString">
2746                                                         <xsl:value-of select="."/>
2747                                                 </xsl:with-param>
2748                                         </xsl:call-template>
2749                                 </title>
2750                         </titleInfo>
2751                 </xsl:for-each>
2752         </xsl:template>
2753         <xsl:template name="relatedTitle76X-78X">
2754                 <xsl:for-each select="marc:subfield[@code='t']">
2755                         <titleInfo>
2756                                 <title>
2757                                         <xsl:call-template name="chopPunctuation">
2758                                                 <xsl:with-param name="chopString">
2759                                                         <xsl:value-of select="."/>
2760                                                 </xsl:with-param>
2761                                         </xsl:call-template>
2762                                 </title>
2763                                 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2764                                         <xsl:call-template name="relatedPartNumName"/>
2765                                 </xsl:if>
2766                         </titleInfo>
2767                 </xsl:for-each>
2768                 <xsl:for-each select="marc:subfield[@code='p']">
2769                         <titleInfo type="abbreviated">
2770                                 <title>
2771                                         <xsl:call-template name="chopPunctuation">
2772                                                 <xsl:with-param name="chopString">
2773                                                         <xsl:value-of select="."/>
2774                                                 </xsl:with-param>
2775                                         </xsl:call-template>
2776                                 </title>
2777                                 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2778                                         <xsl:call-template name="relatedPartNumName"/>
2779                                 </xsl:if>
2780                         </titleInfo>
2781                 </xsl:for-each>
2782                 <xsl:for-each select="marc:subfield[@code='s']">
2783                         <titleInfo type="uniform">
2784                                 <title>
2785                                         <xsl:call-template name="chopPunctuation">
2786                                                 <xsl:with-param name="chopString">
2787                                                         <xsl:value-of select="."/>
2788                                                 </xsl:with-param>
2789                                         </xsl:call-template>
2790                                 </title>
2791                                 <xsl:if test="marc:datafield[@tag!=773]and marc:subfield[@code='g']">
2792                                         <xsl:call-template name="relatedPartNumName"/>
2793                                 </xsl:if>
2794                         </titleInfo>
2795                 </xsl:for-each>
2796         </xsl:template>
2797         <xsl:template name="relatedOriginInfo">
2798                 <xsl:if test="marc:subfield[@code='b' or @code='d'] or marc:subfield[@code='f']">
2799                         <originInfo>
2800                                 <xsl:if test="@tag=775">
2801                                         <xsl:for-each select="marc:subfield[@code='f']">
2802                                                 <place>
2803                                                         <placeTerm>
2804                                                                 <xsl:attribute name="type">code</xsl:attribute>
2805                                                                 <xsl:attribute name="authority">marcgac</xsl:attribute>
2806                                                                 <xsl:value-of select="."/>
2807                                                         </placeTerm>
2808                                                 </place>
2809                                         </xsl:for-each>
2810                                 </xsl:if>
2811                                 <xsl:for-each select="marc:subfield[@code='d']">
2812                                         <publisher>
2813                                                 <xsl:value-of select="."/>
2814                                         </publisher>
2815                                 </xsl:for-each>
2816                                 <xsl:for-each select="marc:subfield[@code='b']">
2817                                         <edition>
2818                                                 <xsl:value-of select="."/>
2819                                         </edition>
2820                                 </xsl:for-each>
2821                         </originInfo>
2822                 </xsl:if>
2823         </xsl:template>
2824         <xsl:template name="relatedLanguage">
2825                 <xsl:for-each select="marc:subfield[@code='e']">
2826                         <xsl:call-template name="getLanguage">
2827                                 <xsl:with-param name="langString">
2828                                         <xsl:value-of select="."/>
2829                                 </xsl:with-param>
2830                         </xsl:call-template>
2831                 </xsl:for-each>
2832         </xsl:template>
2833         <xsl:template name="nameDate">
2834                 <xsl:for-each select="marc:subfield[@code='d']">
2835                         <namePart type="date">
2836                                 <xsl:call-template name="chopPunctuation">
2837                                         <xsl:with-param name="chopString" select="."/>
2838                                 </xsl:call-template>
2839                         </namePart>
2840                 </xsl:for-each>
2841         </xsl:template>
2842         <xsl:template name="subjectAuthority">
2843                 <xsl:if test="@ind2!=4">
2844                         <xsl:if test="@ind2!=' '">
2845                                 <xsl:if test="@ind2!=8">
2846                                         <xsl:if test="@ind2!=9">
2847                                                 <xsl:attribute name="authority">
2848                                                         <xsl:choose>
2849                                                                 <xsl:when test="@ind2=0">lcsh</xsl:when>
2850                                                                 <xsl:when test="@ind2=1">lcshac</xsl:when>
2851                                                                 <xsl:when test="@ind2=2">mesh</xsl:when>
2852                                                                 <!-- 1/04 fix -->
2853                                                                 <xsl:when test="@ind2=3">nal</xsl:when>
2854                                                                 <xsl:when test="@ind2=5">csh</xsl:when>
2855                                                                 <xsl:when test="@ind2=6">rvm</xsl:when>
2856                                                                 <xsl:when test="@ind2=7">
2857                                                                         <xsl:value-of select="marc:subfield[@code='2']"/>
2858                                                                 </xsl:when>
2859                                                         </xsl:choose>
2860                                                 </xsl:attribute>
2861                                         </xsl:if>
2862                                 </xsl:if>
2863                         </xsl:if>
2864                 </xsl:if>
2865         </xsl:template>
2866         <xsl:template name="subjectAnyOrder">
2867                 <xsl:for-each select="marc:subfield[@code='v' or @code='x' or @code='y' or @code='z']">
2868                         <xsl:choose>
2869                                 <xsl:when test="@code='v'">
2870                                         <xsl:call-template name="subjectGenre"/>
2871                                 </xsl:when>
2872                                 <xsl:when test="@code='x'">
2873                                         <xsl:call-template name="subjectTopic"/>
2874                                 </xsl:when>
2875                                 <xsl:when test="@code='y'">
2876                                         <xsl:call-template name="subjectTemporalY"/>
2877                                 </xsl:when>
2878                                 <xsl:when test="@code='z'">
2879                                         <xsl:call-template name="subjectGeographicZ"/>
2880                                 </xsl:when>
2881                         </xsl:choose>
2882                 </xsl:for-each>
2883         </xsl:template>
2884         <xsl:template name="specialSubfieldSelect">
2885                 <xsl:param name="anyCodes"/>
2886                 <xsl:param name="axis"/>
2887                 <xsl:param name="beforeCodes"/>
2888                 <xsl:param name="afterCodes"/>
2889                 <xsl:variable name="str">
2890                         <xsl:for-each select="marc:subfield">
2891                                 <xsl:if
2892                                         test="contains($anyCodes, @code)      or (contains($beforeCodes,@code) and following-sibling::marc:subfield[@code=$axis])      or (contains($afterCodes,@code) and preceding-sibling::marc:subfield[@code=$axis])">
2893                                         <xsl:value-of select="text()"/>
2894                                         <xsl:text> </xsl:text>
2895                                 </xsl:if>
2896                         </xsl:for-each>
2897                 </xsl:variable>
2898                 <xsl:value-of select="substring($str,1,string-length($str)-1)"/>
2899         </xsl:template>
2900
2901         <!-- 3.2 change tmee 6xx $v genre -->
2902         <xsl:template match="marc:datafield[@tag=600]">
2903                 <subject>
2904                         <xsl:call-template name="subjectAuthority"/>
2905                         <name type="personal">
2906                                 <xsl:call-template name="termsOfAddress"/>
2907                                 <namePart>
2908                                         <xsl:call-template name="chopPunctuation">
2909                                                 <xsl:with-param name="chopString">
2910                                                         <xsl:call-template name="subfieldSelect">
2911                                                                 <xsl:with-param name="codes">aq</xsl:with-param>
2912                                                         </xsl:call-template>
2913                                                 </xsl:with-param>
2914                                         </xsl:call-template>
2915                                 </namePart>
2916                                 <xsl:call-template name="nameDate"/>
2917                                 <xsl:call-template name="affiliation"/>
2918                                 <xsl:call-template name="role"/>
2919                         </name>
2920                         <xsl:call-template name="subjectAnyOrder"/>
2921                 </subject>
2922         </xsl:template>
2923         <xsl:template match="marc:datafield[@tag=610]">
2924                 <subject>
2925                         <xsl:call-template name="subjectAuthority"/>
2926                         <name type="corporate">
2927                                 <xsl:for-each select="marc:subfield[@code='a']">
2928                                         <namePart>
2929                                                 <xsl:value-of select="."/>
2930                                         </namePart>
2931                                 </xsl:for-each>
2932                                 <xsl:for-each select="marc:subfield[@code='b']">
2933                                         <namePart>
2934                                                 <xsl:value-of select="."/>
2935                                         </namePart>
2936                                 </xsl:for-each>
2937                                 <xsl:if test="marc:subfield[@code='c' or @code='d' or @code='n' or @code='p']">
2938                                         <namePart>
2939                                                 <xsl:call-template name="subfieldSelect">
2940                                                         <xsl:with-param name="codes">cdnp</xsl:with-param>
2941                                                 </xsl:call-template>
2942                                         </namePart>
2943                                 </xsl:if>
2944                                 <xsl:call-template name="role"/>
2945                         </name>
2946                         <xsl:call-template name="subjectAnyOrder"/>
2947                 </subject>
2948         </xsl:template>
2949         <xsl:template match="marc:datafield[@tag=611]">
2950                 <subject>
2951                         <xsl:call-template name="subjectAuthority"/>
2952                         <name type="conference">
2953                                 <namePart>
2954                                         <xsl:call-template name="subfieldSelect">
2955                                                 <xsl:with-param name="codes">abcdeqnp</xsl:with-param>
2956                                         </xsl:call-template>
2957                                 </namePart>
2958                                 <xsl:for-each select="marc:subfield[@code='4']">
2959                                         <role>
2960                                                 <roleTerm authority="marcrelator" type="code">
2961                                                         <xsl:value-of select="."/>
2962                                                 </roleTerm>
2963                                         </role>
2964                                 </xsl:for-each>
2965                         </name>
2966                         <xsl:call-template name="subjectAnyOrder"/>
2967                 </subject>
2968         </xsl:template>
2969         <xsl:template match="marc:datafield[@tag=630]">
2970                 <subject>
2971                         <xsl:call-template name="subjectAuthority"/>
2972                         <titleInfo>
2973                                 <title>
2974                                         <xsl:call-template name="chopPunctuation">
2975                                                 <xsl:with-param name="chopString">
2976                                                         <xsl:call-template name="subfieldSelect">
2977                                                                 <xsl:with-param name="codes">adfhklor</xsl:with-param>
2978                                                         </xsl:call-template>
2979                                                 </xsl:with-param>
2980                                         </xsl:call-template>
2981                                 </title>
2982                                 <xsl:call-template name="part"/>
2983                         </titleInfo>
2984                         <xsl:call-template name="subjectAnyOrder"/>
2985                 </subject>
2986         </xsl:template>
2987         <!-- 1.27 648 tmee-->
2988         <xsl:template match="marc:datafield[@tag=648]">
2989                 <subject>
2990                         <xsl:if test="marc:subfield[@code=2]">
2991                                 <xsl:attribute name="authority">
2992                                         <xsl:value-of select="marc:subfield[@code=2]"/>
2993                                 </xsl:attribute>
2994                         </xsl:if>
2995                         <xsl:call-template name="uri"/>
2996
2997                         <xsl:call-template name="subjectAuthority"/>
2998                         <temporal>
2999                                 <xsl:call-template name="chopPunctuation">
3000                                         <xsl:with-param name="chopString">
3001                                                 <xsl:call-template name="subfieldSelect">
3002                                                         <xsl:with-param name="codes">abcd</xsl:with-param>
3003                                                 </xsl:call-template>
3004                                         </xsl:with-param>
3005                                 </xsl:call-template>
3006                         </temporal>
3007                         <xsl:call-template name="subjectAnyOrder"/>
3008
3009                 </subject>
3010         </xsl:template>
3011         <xsl:template match="marc:datafield[@tag=650]">
3012                 <subject>
3013                         <xsl:call-template name="subjectAuthority"/>
3014                         <topic>
3015                                 <xsl:call-template name="chopPunctuation">
3016                                         <xsl:with-param name="chopString">
3017                                                 <xsl:call-template name="subfieldSelect">
3018                                                         <xsl:with-param name="codes">abcd</xsl:with-param>
3019                                                 </xsl:call-template>
3020                                         </xsl:with-param>
3021                                 </xsl:call-template>
3022                         </topic>
3023                         <xsl:call-template name="subjectAnyOrder"/>
3024                 </subject>
3025         </xsl:template>
3026         <xsl:template match="marc:datafield[@tag=651]">
3027                 <subject>
3028                         <xsl:call-template name="subjectAuthority"/>
3029                         <xsl:for-each select="marc:subfield[@code='a']">
3030                                 <geographic>
3031                                         <xsl:call-template name="chopPunctuation">
3032                                                 <xsl:with-param name="chopString" select="."/>
3033                                         </xsl:call-template>
3034                                 </geographic>
3035                         </xsl:for-each>
3036                         <xsl:call-template name="subjectAnyOrder"/>
3037                 </subject>
3038         </xsl:template>
3039         <xsl:template match="marc:datafield[@tag=653]">
3040                 <subject>
3041                         <xsl:for-each select="marc:subfield[@code='a']">
3042                                 <topic>
3043                                         <xsl:value-of select="."/>
3044                                 </topic>
3045                         </xsl:for-each>
3046                 </subject>
3047         </xsl:template>
3048         <xsl:template match="marc:datafield[@tag=656]">
3049                 <subject>
3050                         <xsl:if test="marc:subfield[@code=2]">
3051                                 <xsl:attribute name="authority">
3052                                         <xsl:value-of select="marc:subfield[@code=2]"/>
3053                                 </xsl:attribute>
3054                         </xsl:if>
3055                         <occupation>
3056                                 <xsl:call-template name="chopPunctuation">
3057                                         <xsl:with-param name="chopString">
3058                                                 <xsl:value-of select="marc:subfield[@code='a']"/>
3059                                         </xsl:with-param>
3060                                 </xsl:call-template>
3061                         </occupation>
3062                 </subject>
3063         </xsl:template>
3064         <xsl:template name="termsOfAddress">
3065                 <xsl:if test="marc:subfield[@code='b' or @code='c']">
3066                         <namePart type="termsOfAddress">
3067                                 <xsl:call-template name="chopPunctuation">
3068                                         <xsl:with-param name="chopString">
3069                                                 <xsl:call-template name="subfieldSelect">
3070                                                         <xsl:with-param name="codes">bc</xsl:with-param>
3071                                                 </xsl:call-template>
3072                                         </xsl:with-param>
3073                                 </xsl:call-template>
3074                         </namePart>
3075                 </xsl:if>
3076         </xsl:template>
3077         <xsl:template name="displayLabel">
3078                 <xsl:if test="marc:subfield[@code='i']">
3079                         <xsl:attribute name="displayLabel">
3080                                 <xsl:value-of select="marc:subfield[@code='i']"/>
3081                         </xsl:attribute>
3082                 </xsl:if>
3083                 <xsl:if test="marc:subfield[@code='3']">
3084                         <xsl:attribute name="displayLabel">
3085                                 <xsl:value-of select="marc:subfield[@code='3']"/>
3086                         </xsl:attribute>
3087                 </xsl:if>
3088         </xsl:template>
3089         <xsl:template name="isInvalid">
3090                 <xsl:param name="type"/>
3091                 <xsl:if
3092                         test="marc:subfield[@code='z'] or marc:subfield[@code='y']  or marc:subfield[@code='m']">
3093                         <identifier>
3094                                 <xsl:attribute name="type">
3095                                         <xsl:value-of select="$type"/>
3096                                 </xsl:attribute>
3097                                 <xsl:attribute name="invalid">
3098                                         <xsl:text>yes</xsl:text>
3099                                 </xsl:attribute>
3100                                 <xsl:if test="marc:subfield[@code='z']">
3101                                         <xsl:value-of select="marc:subfield[@code='z']"/>
3102                                 </xsl:if>
3103                                 <xsl:if test="marc:subfield[@code='y']">
3104                                         <xsl:value-of select="marc:subfield[@code='y']"/>
3105                                 </xsl:if>
3106                                 <xsl:if test="marc:subfield[@code='m']">
3107                                         <xsl:value-of select="marc:subfield[@code='m']"/>
3108                                 </xsl:if>
3109                         </identifier>
3110                 </xsl:if>
3111         </xsl:template>
3112         <xsl:template name="subtitle">
3113                 <xsl:if test="marc:subfield[@code='b']">
3114                         <subTitle>
3115                                 <xsl:call-template name="chopPunctuation">
3116                                         <xsl:with-param name="chopString">
3117                                                 <xsl:value-of select="marc:subfield[@code='b']"/>
3118                                                 <!--<xsl:call-template name="subfieldSelect">
3119                                                         <xsl:with-param name="codes">b</xsl:with-param>                                                                 
3120                                                 </xsl:call-template>-->
3121                                         </xsl:with-param>
3122                                 </xsl:call-template>
3123                         </subTitle>
3124                 </xsl:if>
3125         </xsl:template>
3126         <xsl:template name="script">
3127                 <xsl:param name="scriptCode"/>
3128                 <xsl:attribute name="script">
3129                         <xsl:choose>
3130                                 <xsl:when test="$scriptCode='(3'">Arabic</xsl:when>
3131                                 <xsl:when test="$scriptCode='(B'">Latin</xsl:when>
3132                                 <xsl:when test="$scriptCode='$1'">Chinese, Japanese, Korean</xsl:when>
3133                                 <xsl:when test="$scriptCode='(N'">Cyrillic</xsl:when>
3134                                 <xsl:when test="$scriptCode='(2'">Hebrew</xsl:when>
3135                                 <xsl:when test="$scriptCode='(S'">Greek</xsl:when>
3136                         </xsl:choose>
3137                 </xsl:attribute>
3138         </xsl:template>
3139         <xsl:template name="parsePart">
3140                 <!-- assumes 773$q= 1:2:3<4
3141                      with up to 3 levels and one optional start page
3142                 -->
3143                 <xsl:variable name="level1">
3144                         <xsl:choose>
3145                                 <xsl:when test="contains(text(),':')">
3146                                         <!-- 1:2 -->
3147                                         <xsl:value-of select="substring-before(text(),':')"/>
3148                                 </xsl:when>
3149                                 <xsl:when test="not(contains(text(),':'))">
3150                                         <!-- 1 or 1<3 -->
3151                                         <xsl:if test="contains(text(),'&lt;')">
3152                                                 <!-- 1<3 -->
3153                                                 <xsl:value-of select="substring-before(text(),'&lt;')"/>
3154                                         </xsl:if>
3155                                         <xsl:if test="not(contains(text(),'&lt;'))">
3156                                                 <!-- 1 -->
3157                                                 <xsl:value-of select="text()"/>
3158                                         </xsl:if>
3159                                 </xsl:when>
3160                         </xsl:choose>
3161                 </xsl:variable>
3162                 <xsl:variable name="sici2">
3163                         <xsl:choose>
3164                                 <xsl:when test="starts-with(substring-after(text(),$level1),':')">
3165                                         <xsl:value-of select="substring(substring-after(text(),$level1),2)"/>
3166                                 </xsl:when>
3167                                 <xsl:otherwise>
3168                                         <xsl:value-of select="substring-after(text(),$level1)"/>
3169                                 </xsl:otherwise>
3170                         </xsl:choose>
3171                 </xsl:variable>
3172                 <xsl:variable name="level2">
3173                         <xsl:choose>
3174                                 <xsl:when test="contains($sici2,':')">
3175                                         <!--  2:3<4  -->
3176                                         <xsl:value-of select="substring-before($sici2,':')"/>
3177                                 </xsl:when>
3178                                 <xsl:when test="contains($sici2,'&lt;')">
3179                                         <!-- 1: 2<4 -->
3180                                         <xsl:value-of select="substring-before($sici2,'&lt;')"/>
3181                                 </xsl:when>
3182                                 <xsl:otherwise>
3183                                         <xsl:value-of select="$sici2"/>
3184                                         <!-- 1:2 -->
3185                                 </xsl:otherwise>
3186                         </xsl:choose>
3187                 </xsl:variable>
3188                 <xsl:variable name="sici3">
3189                         <xsl:choose>
3190                                 <xsl:when test="starts-with(substring-after($sici2,$level2),':')">
3191                                         <xsl:value-of select="substring(substring-after($sici2,$level2),2)"/>
3192                                 </xsl:when>
3193                                 <xsl:otherwise>
3194                                         <xsl:value-of select="substring-after($sici2,$level2)"/>
3195                                 </xsl:otherwise>
3196                         </xsl:choose>
3197                 </xsl:variable>
3198                 <xsl:variable name="level3">
3199                         <xsl:choose>
3200                                 <xsl:when test="contains($sici3,'&lt;')">
3201                                         <!-- 2<4 -->
3202                                         <xsl:value-of select="substring-before($sici3,'&lt;')"/>
3203                                 </xsl:when>
3204                                 <xsl:otherwise>
3205                                         <xsl:value-of select="$sici3"/>
3206                                         <!-- 3 -->
3207                                 </xsl:otherwise>
3208                         </xsl:choose>
3209                 </xsl:variable>
3210                 <xsl:variable name="page">
3211                         <xsl:if test="contains(text(),'&lt;')">
3212                                 <xsl:value-of select="substring-after(text(),'&lt;')"/>
3213                         </xsl:if>
3214                 </xsl:variable>
3215                 <xsl:if test="$level1">
3216                         <detail level="1">
3217                                 <number>
3218                                         <xsl:value-of select="$level1"/>
3219                                 </number>
3220                         </detail>
3221                 </xsl:if>
3222                 <xsl:if test="$level2">
3223                         <detail level="2">
3224                                 <number>
3225                                         <xsl:value-of select="$level2"/>
3226                                 </number>
3227                         </detail>
3228                 </xsl:if>
3229                 <xsl:if test="$level3">
3230                         <detail level="3">
3231                                 <number>
3232                                         <xsl:value-of select="$level3"/>
3233                                 </number>
3234                         </detail>
3235                 </xsl:if>
3236                 <xsl:if test="$page">
3237                         <extent unit="page">
3238                                 <start>
3239                                         <xsl:value-of select="$page"/>
3240                                 </start>
3241                         </extent>
3242                 </xsl:if>
3243         </xsl:template>
3244         <xsl:template name="getLanguage">
3245                 <xsl:param name="langString"/>
3246                 <xsl:param name="controlField008-35-37"/>
3247                 <xsl:variable name="length" select="string-length($langString)"/>
3248                 <xsl:choose>
3249                         <xsl:when test="$length=0"/>
3250                         <xsl:when test="$controlField008-35-37=substring($langString,1,3)">
3251                                 <xsl:call-template name="getLanguage">
3252                                         <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
3253                                         <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
3254                                 </xsl:call-template>
3255                         </xsl:when>
3256                         <xsl:otherwise>
3257                                 <language>
3258                                         <languageTerm authority="iso639-2b" type="code">
3259                                                 <xsl:value-of select="substring($langString,1,3)"/>
3260                                         </languageTerm>
3261                                 </language>
3262                                 <xsl:call-template name="getLanguage">
3263                                         <xsl:with-param name="langString" select="substring($langString,4,$length)"/>
3264                                         <xsl:with-param name="controlField008-35-37" select="$controlField008-35-37"/>
3265                                 </xsl:call-template>
3266                         </xsl:otherwise>
3267                 </xsl:choose>
3268         </xsl:template>
3269         <xsl:template name="isoLanguage">
3270                 <xsl:param name="currentLanguage"/>
3271                 <xsl:param name="usedLanguages"/>
3272                 <xsl:param name="remainingLanguages"/>
3273                 <xsl:choose>
3274                         <xsl:when test="string-length($currentLanguage)=0"/>
3275                         <xsl:when test="not(contains($usedLanguages, $currentLanguage))">
3276                                 <language>
3277                                         <xsl:if test="@code!='a'">
3278                                                 <xsl:attribute name="objectPart">
3279                                                         <xsl:choose>
3280                                                                 <xsl:when test="@code='b'">summary or subtitle</xsl:when>
3281                                                                 <xsl:when test="@code='d'">sung or spoken text</xsl:when>
3282                                                                 <xsl:when test="@code='e'">libretto</xsl:when>
3283                                                                 <xsl:when test="@code='f'">table of contents</xsl:when>
3284                                                                 <xsl:when test="@code='g'">accompanying material</xsl:when>
3285                                                                 <xsl:when test="@code='h'">translation</xsl:when>
3286                                                         </xsl:choose>
3287                                                 </xsl:attribute>
3288                                         </xsl:if>
3289                                         <languageTerm authority="iso639-2b" type="code">
3290                                                 <xsl:value-of select="$currentLanguage"/>
3291                                         </languageTerm>
3292                                 </language>
3293                                 <xsl:call-template name="isoLanguage">
3294                                         <xsl:with-param name="currentLanguage">
3295                                                 <xsl:value-of select="substring($remainingLanguages,1,3)"/>
3296                                         </xsl:with-param>
3297                                         <xsl:with-param name="usedLanguages">
3298                                                 <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
3299                                         </xsl:with-param>
3300                                         <xsl:with-param name="remainingLanguages">
3301                                                 <xsl:value-of
3302                                                         select="substring($remainingLanguages,4,string-length($remainingLanguages))"
3303                                                 />
3304                                         </xsl:with-param>
3305                                 </xsl:call-template>
3306                         </xsl:when>
3307                         <xsl:otherwise>
3308                                 <xsl:call-template name="isoLanguage">
3309                                         <xsl:with-param name="currentLanguage">
3310                                                 <xsl:value-of select="substring($remainingLanguages,1,3)"/>
3311                                         </xsl:with-param>
3312                                         <xsl:with-param name="usedLanguages">
3313                                                 <xsl:value-of select="concat($usedLanguages,$currentLanguage)"/>
3314                                         </xsl:with-param>
3315                                         <xsl:with-param name="remainingLanguages">
3316                                                 <xsl:value-of
3317                                                         select="substring($remainingLanguages,4,string-length($remainingLanguages))"
3318                                                 />
3319                                         </xsl:with-param>
3320                                 </xsl:call-template>
3321                         </xsl:otherwise>
3322                 </xsl:choose>
3323         </xsl:template>
3324         <xsl:template name="chopBrackets">
3325                 <xsl:param name="chopString"/>
3326                 <xsl:variable name="string">
3327                         <xsl:call-template name="chopPunctuation">
3328                                 <xsl:with-param name="chopString" select="$chopString"/>
3329                         </xsl:call-template>
3330                 </xsl:variable>
3331                 <xsl:if test="substring($string, 1,1)='['">
3332                         <xsl:value-of select="substring($string,2, string-length($string)-2)"/>
3333                 </xsl:if>
3334                 <xsl:if test="substring($string, 1,1)!='['">
3335                         <xsl:value-of select="$string"/>
3336                 </xsl:if>
3337         </xsl:template>
3338         <xsl:template name="rfcLanguages">
3339                 <xsl:param name="nodeNum"/>
3340                 <xsl:param name="usedLanguages"/>
3341                 <xsl:param name="controlField008-35-37"/>
3342                 <xsl:variable name="currentLanguage" select="."/>
3343                 <xsl:choose>
3344                         <xsl:when test="not($currentLanguage)"/>
3345                         <xsl:when
3346                                 test="$currentLanguage!=$controlField008-35-37 and $currentLanguage!='rfc3066'">
3347                                 <xsl:if test="not(contains($usedLanguages,$currentLanguage))">
3348                                         <language>
3349                                                 <xsl:if test="@code!='a'">
3350                                                         <xsl:attribute name="objectPart">
3351                                                                 <xsl:choose>
3352                                                                         <xsl:when test="@code='b'">summary or subtitle</xsl:when>
3353                                                                         <xsl:when test="@code='d'">sung or spoken text</xsl:when>
3354                                                                         <xsl:when test="@code='e'">libretto</xsl:when>
3355                                                                         <xsl:when test="@code='f'">table of contents</xsl:when>
3356                                                                         <xsl:when test="@code='g'">accompanying material</xsl:when>
3357                                                                         <xsl:when test="@code='h'">translation</xsl:when>
3358                                                                 </xsl:choose>
3359                                                         </xsl:attribute>
3360                                                 </xsl:if>
3361                                                 <languageTerm authority="rfc3066" type="code">
3362                                                         <xsl:value-of select="$currentLanguage"/>
3363                                                 </languageTerm>
3364                                         </language>
3365                                 </xsl:if>
3366                         </xsl:when>
3367                         <xsl:otherwise> </xsl:otherwise>
3368                 </xsl:choose>
3369         </xsl:template>
3370
3371     <xsl:template name="datafield">
3372                 <xsl:param name="tag"/>
3373                 <xsl:param name="ind1">
3374                         <xsl:text> </xsl:text>
3375                 </xsl:param>
3376                 <xsl:param name="ind2">
3377                         <xsl:text> </xsl:text>
3378                 </xsl:param>
3379                 <xsl:param name="subfields"/>
3380                 <xsl:element name="marc:datafield">
3381                         <xsl:attribute name="tag">
3382                                 <xsl:value-of select="$tag"/>
3383                         </xsl:attribute>
3384                         <xsl:attribute name="ind1">
3385                                 <xsl:value-of select="$ind1"/>
3386                         </xsl:attribute>
3387                         <xsl:attribute name="ind2">
3388                                 <xsl:value-of select="$ind2"/>
3389                         </xsl:attribute>
3390                         <xsl:copy-of select="$subfields"/>
3391                 </xsl:element>
3392         </xsl:template>
3393
3394         <xsl:template name="subfieldSelect">
3395                 <xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param>
3396                 <xsl:param name="delimeter">
3397                         <xsl:text> </xsl:text>
3398                 </xsl:param>
3399                 <xsl:variable name="str">
3400                         <xsl:for-each select="marc:subfield">
3401                                 <xsl:if test="contains($codes, @code)">
3402                                         <xsl:value-of select="text()"/>
3403                                         <xsl:value-of select="$delimeter"/>
3404                                 </xsl:if>
3405                         </xsl:for-each>
3406                 </xsl:variable>
3407                 <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
3408         </xsl:template>
3409
3410         <xsl:template name="buildSpaces">
3411                 <xsl:param name="spaces"/>
3412                 <xsl:param name="char">
3413                         <xsl:text> </xsl:text>
3414                 </xsl:param>
3415                 <xsl:if test="$spaces>0">
3416                         <xsl:value-of select="$char"/>
3417                         <xsl:call-template name="buildSpaces">
3418                                 <xsl:with-param name="spaces" select="$spaces - 1"/>
3419                                 <xsl:with-param name="char" select="$char"/>
3420                         </xsl:call-template>
3421                 </xsl:if>
3422         </xsl:template>
3423
3424         <xsl:template name="chopPunctuation">
3425                 <xsl:param name="chopString"/>
3426                 <xsl:param name="punctuation">
3427                         <xsl:text>.:,;/ </xsl:text>
3428                 </xsl:param>
3429                 <xsl:variable name="length" select="string-length($chopString)"/>
3430                 <xsl:choose>
3431                         <xsl:when test="$length=0"/>
3432                         <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
3433                                 <xsl:call-template name="chopPunctuation">
3434                                         <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
3435                                         <xsl:with-param name="punctuation" select="$punctuation"/>
3436                                 </xsl:call-template>
3437                         </xsl:when>
3438                         <xsl:when test="not($chopString)"/>
3439                         <xsl:otherwise>
3440                                 <xsl:value-of select="$chopString"/>
3441                         </xsl:otherwise>
3442                 </xsl:choose>
3443         </xsl:template>
3444
3445         <xsl:template name="chopPunctuationFront">
3446                 <xsl:param name="chopString"/>
3447                 <xsl:variable name="length" select="string-length($chopString)"/>
3448                 <xsl:choose>
3449                         <xsl:when test="$length=0"/>
3450                         <xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
3451                                 <xsl:call-template name="chopPunctuationFront">
3452                                         <xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"
3453                                         />
3454                                 </xsl:call-template>
3455                         </xsl:when>
3456                         <xsl:when test="not($chopString)"/>
3457                         <xsl:otherwise>
3458                                 <xsl:value-of select="$chopString"/>
3459                         </xsl:otherwise>
3460                 </xsl:choose>
3461         </xsl:template>
3462
3463         <xsl:template name="chopPunctuationBack">
3464                 <xsl:param name="chopString"/>
3465                 <xsl:param name="punctuation">
3466                         <xsl:text>.:,;/] </xsl:text>
3467                 </xsl:param>
3468                 <xsl:variable name="length" select="string-length($chopString)"/>
3469                 <xsl:choose>
3470                         <xsl:when test="$length=0"/>
3471                         <xsl:when test="contains($punctuation, substring($chopString,$length,1))">
3472                                 <xsl:call-template name="chopPunctuation">
3473                                         <xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
3474                                         <xsl:with-param name="punctuation" select="$punctuation"/>
3475                                 </xsl:call-template>
3476                         </xsl:when>
3477                         <xsl:when test="not($chopString)"/>
3478                         <xsl:otherwise>
3479                                 <xsl:value-of select="$chopString"/>
3480                         </xsl:otherwise>
3481                 </xsl:choose>
3482         </xsl:template>
3483
3484         <!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. -->
3485         <xsl:template name="url-encode">
3486
3487                 <xsl:param name="str"/>
3488
3489                 <xsl:if test="$str">
3490                         <xsl:variable name="first-char" select="substring($str,1,1)"/>
3491                         <xsl:choose>
3492                                 <xsl:when test="contains($safe,$first-char)">
3493                                         <xsl:value-of select="$first-char"/>
3494                                 </xsl:when>
3495                                 <xsl:otherwise>
3496                                         <xsl:variable name="codepoint">
3497                                                 <xsl:choose>
3498                                                         <xsl:when test="contains($ascii,$first-char)">
3499                                                                 <xsl:value-of
3500                                                                         select="string-length(substring-before($ascii,$first-char)) + 32"
3501                                                                 />
3502                                                         </xsl:when>
3503                                                         <xsl:when test="contains($latin1,$first-char)">
3504                                                                 <xsl:value-of
3505                                                                         select="string-length(substring-before($latin1,$first-char)) + 160"/>
3506                                                                 <!-- was 160 -->
3507                                                         </xsl:when>
3508                                                         <xsl:otherwise>
3509                                                                 <xsl:message terminate="no">Warning: string contains a character
3510                                                                         that is out of range! Substituting "?".</xsl:message>
3511                                                                 <xsl:text>63</xsl:text>
3512                                                         </xsl:otherwise>
3513                                                 </xsl:choose>
3514                                         </xsl:variable>
3515                                         <xsl:variable name="hex-digit1"
3516                                                 select="substring($hex,floor($codepoint div 16) + 1,1)"/>
3517                                         <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
3518                                         <!-- <xsl:value-of select="concat('%',$hex-digit2)"/> -->
3519                                         <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
3520                                 </xsl:otherwise>
3521                         </xsl:choose>
3522                         <xsl:if test="string-length($str) &gt; 1">
3523                                 <xsl:call-template name="url-encode">
3524                                         <xsl:with-param name="str" select="substring($str,2)"/>
3525                                 </xsl:call-template>
3526                         </xsl:if>
3527                 </xsl:if>
3528         </xsl:template>
3529 </xsl:stylesheet>$$ WHERE name = 'mods33';
3530