Lines 6-48
Link Here
|
6 |
xmlns:str="http://exslt.org/strings" |
6 |
xmlns:str="http://exslt.org/strings" |
7 |
exclude-result-prefixes="marc str"> |
7 |
exclude-result-prefixes="marc str"> |
8 |
<xsl:include href="MARC21Languages.xsl"/> |
8 |
<xsl:include href="MARC21Languages.xsl"/> |
9 |
<xsl:template name="datafield"> |
9 |
<xsl:template name="datafield"> |
10 |
<xsl:param name="tag"/> |
10 |
<xsl:param name="tag"/> |
11 |
<xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param> |
11 |
<xsl:param name="ind1"><xsl:text> </xsl:text></xsl:param> |
12 |
<xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param> |
12 |
<xsl:param name="ind2"><xsl:text> </xsl:text></xsl:param> |
13 |
<xsl:param name="subfields"/> |
13 |
<xsl:param name="subfields"/> |
14 |
<xsl:element name="datafield"> |
14 |
<xsl:element name="datafield"> |
15 |
<xsl:attribute name="tag"> |
15 |
<xsl:attribute name="tag"> |
16 |
<xsl:value-of select="$tag"/> |
16 |
<xsl:value-of select="$tag"/> |
17 |
</xsl:attribute> |
17 |
</xsl:attribute> |
18 |
<xsl:attribute name="ind1"> |
18 |
<xsl:attribute name="ind1"> |
19 |
<xsl:value-of select="$ind1"/> |
19 |
<xsl:value-of select="$ind1"/> |
20 |
</xsl:attribute> |
20 |
</xsl:attribute> |
21 |
<xsl:attribute name="ind2"> |
21 |
<xsl:attribute name="ind2"> |
22 |
<xsl:value-of select="$ind2"/> |
22 |
<xsl:value-of select="$ind2"/> |
23 |
</xsl:attribute> |
23 |
</xsl:attribute> |
24 |
<xsl:copy-of select="$subfields"/> |
24 |
<xsl:copy-of select="$subfields"/> |
25 |
</xsl:element> |
25 |
</xsl:element> |
26 |
</xsl:template> |
26 |
</xsl:template> |
27 |
|
27 |
|
28 |
<xsl:template name="subfieldSelect"> |
28 |
<xsl:template name="subfieldSelect"> |
29 |
<xsl:param name="codes"/> |
29 |
<xsl:param name="codes"/> |
30 |
<xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param> |
30 |
<xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param> |
31 |
<xsl:param name="subdivCodes"/> |
31 |
<xsl:param name="subdivCodes"/> |
32 |
<xsl:param name="subdivDelimiter"/> |
32 |
<xsl:param name="subdivDelimiter"/> |
33 |
<xsl:param name="prefix"/> |
33 |
<xsl:param name="prefix"/> |
34 |
<xsl:param name="suffix"/> |
34 |
<xsl:param name="suffix"/> |
35 |
<xsl:param name="urlencode"/> |
35 |
<xsl:param name="urlencode"/> |
36 |
<xsl:variable name="str"> |
36 |
<xsl:variable name="str"> |
37 |
<xsl:for-each select="marc:subfield"> |
37 |
<xsl:for-each select="marc:subfield"> |
38 |
<xsl:if test="contains($codes, @code)"> |
38 |
<xsl:if test="contains($codes, @code)"> |
39 |
<xsl:if test="contains($subdivCodes, @code)"> |
39 |
<xsl:if test="contains($subdivCodes, @code)"> |
40 |
<xsl:value-of select="$subdivDelimiter"/> |
40 |
<xsl:value-of select="$subdivDelimiter"/> |
41 |
</xsl:if> |
41 |
</xsl:if> |
42 |
<xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/> |
42 |
<xsl:value-of select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/> |
43 |
</xsl:if> |
43 |
</xsl:if> |
44 |
</xsl:for-each> |
44 |
</xsl:for-each> |
45 |
</xsl:variable> |
45 |
</xsl:variable> |
46 |
<xsl:choose> |
46 |
<xsl:choose> |
47 |
<xsl:when test="$urlencode=1"> |
47 |
<xsl:when test="$urlencode=1"> |
48 |
<xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/> |
48 |
<xsl:value-of select="str:encode-uri(substring($str,1,string-length($str)-string-length($delimeter)), true())"/> |
Lines 51-57
Link Here
|
51 |
<xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> |
51 |
<xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> |
52 |
</xsl:otherwise> |
52 |
</xsl:otherwise> |
53 |
</xsl:choose> |
53 |
</xsl:choose> |
54 |
</xsl:template> |
54 |
</xsl:template> |
55 |
|
55 |
|
56 |
<xsl:template name="subfieldSelectSpan"> |
56 |
<xsl:template name="subfieldSelectSpan"> |
57 |
<xsl:param name="codes"/> |
57 |
<xsl:param name="codes"/> |
Lines 79-95
Link Here
|
79 |
</xsl:for-each> |
79 |
</xsl:for-each> |
80 |
</xsl:template> |
80 |
</xsl:template> |
81 |
|
81 |
|
82 |
<xsl:template name="buildSpaces"> |
82 |
<xsl:template name="buildSpaces"> |
83 |
<xsl:param name="spaces"/> |
83 |
<xsl:param name="spaces"/> |
84 |
<xsl:param name="char"><xsl:text> </xsl:text></xsl:param> |
84 |
<xsl:param name="char"><xsl:text> </xsl:text></xsl:param> |
85 |
<xsl:if test="$spaces>0"> |
85 |
<xsl:if test="$spaces>0"> |
86 |
<xsl:value-of select="$char"/> |
86 |
<xsl:value-of select="$char"/> |
87 |
<xsl:call-template name="buildSpaces"> |
87 |
<xsl:call-template name="buildSpaces"> |
88 |
<xsl:with-param name="spaces" select="$spaces - 1"/> |
88 |
<xsl:with-param name="spaces" select="$spaces - 1"/> |
89 |
<xsl:with-param name="char" select="$char"/> |
89 |
<xsl:with-param name="char" select="$char"/> |
90 |
</xsl:call-template> |
90 |
</xsl:call-template> |
91 |
</xsl:if> |
91 |
</xsl:if> |
92 |
</xsl:template> |
92 |
</xsl:template> |
93 |
|
93 |
|
94 |
<xsl:template name="buildBiblioDefaultViewURL"> |
94 |
<xsl:template name="buildBiblioDefaultViewURL"> |
95 |
<xsl:param name="IntranetBiblioDefaultView"/> |
95 |
<xsl:param name="IntranetBiblioDefaultView"/> |
Lines 112-153
Link Here
|
112 |
</xsl:choose> |
112 |
</xsl:choose> |
113 |
</xsl:template> |
113 |
</xsl:template> |
114 |
|
114 |
|
115 |
<xsl:template name="chopPunctuation"> |
115 |
<xsl:template name="chopPunctuation"> |
116 |
<xsl:param name="chopString"/> |
116 |
<xsl:param name="chopString"/> |
117 |
<xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param> |
117 |
<xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param> |
118 |
<xsl:variable name="length" select="string-length($chopString)"/> |
118 |
<xsl:variable name="length" select="string-length($chopString)"/> |
119 |
<xsl:choose> |
119 |
<xsl:choose> |
120 |
<xsl:when test="$length=0"/> |
120 |
<xsl:when test="$length=0"/> |
121 |
<xsl:when test="contains($punctuation, substring($chopString,$length,1))"> |
121 |
<xsl:when test="contains($punctuation, substring($chopString,$length,1))"> |
122 |
<xsl:call-template name="chopPunctuation"> |
122 |
<xsl:call-template name="chopPunctuation"> |
123 |
<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> |
123 |
<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/> |
124 |
<xsl:with-param name="punctuation" select="$punctuation"/> |
124 |
<xsl:with-param name="punctuation" select="$punctuation"/> |
125 |
</xsl:call-template> |
125 |
</xsl:call-template> |
126 |
</xsl:when> |
126 |
</xsl:when> |
127 |
<xsl:when test="not($chopString)"/> |
127 |
<xsl:when test="not($chopString)"/> |
128 |
<xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise> |
128 |
<xsl:otherwise><xsl:value-of select="$chopString"/></xsl:otherwise> |
129 |
</xsl:choose> |
129 |
</xsl:choose> |
130 |
</xsl:template> |
130 |
</xsl:template> |
131 |
|
131 |
|
132 |
<!-- Function extractControlNumber is used to extract the control number (record number) from MARC tags 773/80/85 [etc.] subfield $w. |
132 |
<!-- Function extractControlNumber is used to extract the control number (record number) from MARC tags 773/80/85 [etc.] subfield $w. |
133 |
Parameter: control number string. |
133 |
Parameter: control number string. |
134 |
Assumes LOC convention: (OrgCode)recordNumber. |
134 |
Assumes LOC convention: (OrgCode)recordNumber. |
135 |
If OrgCode is not present, return full string. |
135 |
If OrgCode is not present, return full string. |
136 |
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces. |
136 |
Additionally, handle various brackets/parentheses. Chop leading and trailing spaces. |
137 |
Returns the value URI-encoded. |
137 |
Returns the value URI-encoded. |
138 |
--> |
138 |
--> |
139 |
<xsl:template name="extractControlNumber"> |
139 |
<xsl:template name="extractControlNumber"> |
140 |
<xsl:param name="subfieldW"/> |
140 |
<xsl:param name="subfieldW"/> |
141 |
<xsl:variable name="tranW" select="translate($subfieldW,']})>','))))')"/> |
141 |
<xsl:variable name="tranW" select="translate($subfieldW,']})>','))))')"/> |
142 |
<xsl:choose> |
142 |
<xsl:choose> |
143 |
<xsl:when test="contains($tranW,')')"> |
143 |
<xsl:when test="contains($tranW,')')"> |
144 |
<xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), true())"/> |
144 |
<xsl:value-of select="str:encode-uri(normalize-space(translate(substring-after($tranW,')'),'[]{}()<>','')), true())"/> |
145 |
</xsl:when> |
145 |
</xsl:when> |
146 |
<xsl:otherwise> |
146 |
<xsl:otherwise> |
147 |
<xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/> |
147 |
<xsl:value-of select="str:encode-uri(normalize-space($subfieldW), true())"/> |
148 |
</xsl:otherwise> |
148 |
</xsl:otherwise> |
149 |
</xsl:choose> |
149 |
</xsl:choose> |
150 |
</xsl:template> |
150 |
</xsl:template> |
151 |
|
151 |
|
152 |
<!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags |
152 |
<!-- Function m880Select: Display Alternate Graphic Representation (MARC 880) for selected latin "base"tags |
153 |
- should be called immediately before the corresonding latin tags are processed |
153 |
- should be called immediately before the corresonding latin tags are processed |
Lines 356-385
Link Here
|
356 |
|
356 |
|
357 |
<xsl:template name="show-lang-041"> |
357 |
<xsl:template name="show-lang-041"> |
358 |
<xsl:if test="marc:datafield[@tag=041]"> |
358 |
<xsl:if test="marc:datafield[@tag=041]"> |
359 |
<xsl:for-each select="marc:datafield[@tag=041]"> |
359 |
<xsl:for-each select="marc:datafield[@tag=041]"> |
360 |
<span class="results_summary languages"> |
360 |
<span class="results_summary languages"> |
361 |
<xsl:call-template name="show-lang-node"> |
361 |
<xsl:call-template name="show-lang-node"> |
362 |
<xsl:with-param name="langNode" select="marc:subfield[@code='a']"/> |
362 |
<xsl:with-param name="langNode" select="marc:subfield[@code='a']"/> |
363 |
<xsl:with-param name="langLabel">Language: </xsl:with-param> |
363 |
<xsl:with-param name="langLabel">Language: </xsl:with-param> |
364 |
</xsl:call-template> |
364 |
</xsl:call-template> |
365 |
<xsl:call-template name="show-lang-node"> |
365 |
<xsl:call-template name="show-lang-node"> |
366 |
<xsl:with-param name="langNode" select="marc:subfield[@code='b']"/> |
366 |
<xsl:with-param name="langNode" select="marc:subfield[@code='b']"/> |
367 |
<xsl:with-param name="langLabel">Summary language: </xsl:with-param> |
367 |
<xsl:with-param name="langLabel">Summary language: </xsl:with-param> |
368 |
</xsl:call-template> |
368 |
</xsl:call-template> |
369 |
<xsl:call-template name="show-lang-node"> |
369 |
<xsl:call-template name="show-lang-node"> |
370 |
<xsl:with-param name="langNode" select="marc:subfield[@code='d']"/> |
370 |
<xsl:with-param name="langNode" select="marc:subfield[@code='d']"/> |
371 |
<xsl:with-param name="langLabel">Spoken language: </xsl:with-param> |
371 |
<xsl:with-param name="langLabel">Spoken language: </xsl:with-param> |
372 |
</xsl:call-template> |
372 |
</xsl:call-template> |
373 |
<xsl:call-template name="show-lang-node"> |
373 |
<xsl:call-template name="show-lang-node"> |
374 |
<xsl:with-param name="langNode" select="marc:subfield[@code='h']"/> |
374 |
<xsl:with-param name="langNode" select="marc:subfield[@code='h']"/> |
375 |
<xsl:with-param name="langLabel">Original language: </xsl:with-param> |
375 |
<xsl:with-param name="langLabel">Original language: </xsl:with-param> |
376 |
</xsl:call-template> |
376 |
</xsl:call-template> |
377 |
<xsl:call-template name="show-lang-node"> |
377 |
<xsl:call-template name="show-lang-node"> |
378 |
<xsl:with-param name="langNode" select="marc:subfield[@code='j']"/> |
378 |
<xsl:with-param name="langNode" select="marc:subfield[@code='j']"/> |
379 |
<xsl:with-param name="langLabel">Subtitle language: </xsl:with-param> |
379 |
<xsl:with-param name="langLabel">Subtitle language: </xsl:with-param> |
380 |
</xsl:call-template> |
380 |
</xsl:call-template> |
381 |
</span> |
381 |
</span> |
382 |
</xsl:for-each> |
382 |
</xsl:for-each> |
383 |
</xsl:if> |
383 |
</xsl:if> |
384 |
</xsl:template> |
384 |
</xsl:template> |
385 |
|
385 |
|
Lines 387-407
Link Here
|
387 |
<xsl:param name="langNode"/> |
387 |
<xsl:param name="langNode"/> |
388 |
<xsl:param name="langLabel"/> |
388 |
<xsl:param name="langLabel"/> |
389 |
<xsl:if test="$langNode"> |
389 |
<xsl:if test="$langNode"> |
390 |
<span class="language"> |
390 |
<span class="language"> |
391 |
<span class="label"><xsl:value-of select="$langLabel"/></span> |
391 |
<span class="label"><xsl:value-of select="$langLabel"/></span> |
392 |
<xsl:for-each select="$langNode"> |
392 |
<xsl:for-each select="$langNode"> |
393 |
<span> |
393 |
<span> |
394 |
<xsl:attribute name="class">lang_code-<xsl:value-of select="translate(., ' .-;|#', '_')"/></xsl:attribute> |
394 |
<xsl:attribute name="class">lang_code-<xsl:value-of select="translate(., ' .-;|#', '_')"/></xsl:attribute> |
395 |
<xsl:call-template name="languageCodeText"> |
395 |
<xsl:call-template name="languageCodeText"> |
396 |
<xsl:with-param name="code" select="."/> |
396 |
<xsl:with-param name="code" select="."/> |
397 |
</xsl:call-template> |
397 |
</xsl:call-template> |
398 |
<xsl:if test="position() != last()"> |
398 |
<xsl:if test="position() != last()"> |
399 |
<span class="sep"><xsl:text>, </xsl:text></span> |
399 |
<span class="sep"><xsl:text>, </xsl:text></span> |
400 |
</xsl:if> |
400 |
</xsl:if> |
401 |
</span> |
401 |
</span> |
402 |
</xsl:for-each> |
402 |
</xsl:for-each> |
403 |
<span class="sep"><xsl:text>. </xsl:text></span> |
403 |
<span class="sep"><xsl:text>. </xsl:text></span> |
404 |
</span> |
404 |
</span> |
405 |
</xsl:if> |
405 |
</xsl:if> |
406 |
</xsl:template> |
406 |
</xsl:template> |
407 |
|
407 |
|