View | Details | Raw Unified | Return to bug 28976
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl (-5 / +114 lines)
Lines 440-452 Link Here
440
                                <!-- Prefer j over 4 -->
440
                                <!-- Prefer j over 4 -->
441
                                <xsl:when test="marc:subfield[@code='j']">
441
                                <xsl:when test="marc:subfield[@code='j']">
442
                                    <xsl:for-each select="marc:subfield[@code='j']">
442
                                    <xsl:for-each select="marc:subfield[@code='j']">
443
                                        <xsl:value-of select="."/>
443
                                        <xsl:call-template name="chopPunctuation">
444
                                            <xsl:with-param name="chopString">
445
                                                <xsl:value-of select="text()"/>
446
                                            </xsl:with-param>
447
                                            <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param>
448
                                        </xsl:call-template>
444
                                        <xsl:if test="position() != last()">, </xsl:if>
449
                                        <xsl:if test="position() != last()">, </xsl:if>
445
                                    </xsl:for-each>
450
                                    </xsl:for-each>
446
                                </xsl:when>
451
                                </xsl:when>
447
                                <xsl:otherwise>
452
                                <xsl:otherwise>
448
                                    <xsl:for-each select="marc:subfield[@code=4]">
453
                                    <xsl:for-each select="marc:subfield[@code=4]">
449
                                        <xsl:value-of select="."/>
454
                                        <xsl:call-template name="chopPunctuation">
455
                                            <xsl:with-param name="chopString">
456
                                                <xsl:value-of select="text()"/>
457
                                            </xsl:with-param>
458
                                            <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param>
459
                                        </xsl:call-template>
450
                                        <xsl:if test="position() != last()">, </xsl:if>
460
                                        <xsl:if test="position() != last()">, </xsl:if>
451
                                    </xsl:for-each>
461
                                    </xsl:for-each>
452
                                </xsl:otherwise>
462
                                </xsl:otherwise>
Lines 455-467 Link Here
455
                        <!-- Prefer e over 4 -->
465
                        <!-- Prefer e over 4 -->
456
                        <xsl:when test="marc:subfield[@code='e']">
466
                        <xsl:when test="marc:subfield[@code='e']">
457
                            <xsl:for-each select="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
467
                            <xsl:for-each select="marc:subfield[@code='e'][not(@tag=111) or not(@tag=711)]">
458
                                <xsl:value-of select="."/>
468
                                <xsl:call-template name="chopPunctuation">
469
                                    <xsl:with-param name="chopString">
470
                                        <xsl:value-of select="text()"/>
471
                                    </xsl:with-param>
472
                                    <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param>
473
                                </xsl:call-template>
459
                                <xsl:if test="position() != last()">, </xsl:if>
474
                                <xsl:if test="position() != last()">, </xsl:if>
460
                            </xsl:for-each>
475
                            </xsl:for-each>
461
                        </xsl:when>
476
                        </xsl:when>
462
                        <xsl:otherwise>
477
                        <xsl:otherwise>
463
                            <xsl:for-each select="marc:subfield[@code=4]">
478
                            <xsl:for-each select="marc:subfield[@code=4]">
464
                                <xsl:value-of select="."/>
479
                                <xsl:call-template name="chopPunctuation">
480
                                    <xsl:with-param name="chopString">
481
                                        <xsl:value-of select="text()"/>
482
                                    </xsl:with-param>
483
                                    <xsl:with-param name="punctuation"><xsl:text>.</xsl:text></xsl:with-param>
484
                                </xsl:call-template>
465
                                <xsl:if test="position() != last()">, </xsl:if>
485
                                <xsl:if test="position() != last()">, </xsl:if>
466
                            </xsl:for-each>
486
                            </xsl:for-each>
467
                        </xsl:otherwise>
487
                        </xsl:otherwise>
Lines 470-476 Link Here
470
                </span>
490
                </span>
471
            </xsl:if>
491
            </xsl:if>
472
            <xsl:choose>
492
            <xsl:choose>
473
                <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
493
                <!-- Test to choose if we add a period at the end of the line or if there is already one  -->
494
                <xsl:when test="position()=last()">
495
                    <xsl:choose>
496
                        <xsl:when test="@tag=100 or @tag=700">
497
                           <xsl:choose>
498
                                <xsl:when test="marc:subfield[@code='e']">
499
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='e']"/></xsl:variable>
500
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
501
                                    <xsl:if test="$lastchar != '.'">
502
                                        <xsl:text>.</xsl:text>
503
                                    </xsl:if>
504
                                </xsl:when>
505
                                <xsl:when test="marc:subfield[@code='4']">
506
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='4']"/></xsl:variable>
507
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
508
                                    <xsl:if test="$lastchar != '.'">
509
                                        <xsl:text>.</xsl:text>
510
                                    </xsl:if>
511
                                </xsl:when>
512
                                <xsl:when test="marc:subfield[@code='d']">
513
                                    <xsl:text>.</xsl:text>
514
                                </xsl:when>
515
                                <xsl:otherwise>
516
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable>
517
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
518
                                    <xsl:if test="$lastchar != '.'">
519
                                        <xsl:text>.</xsl:text>
520
                                    </xsl:if>
521
                                </xsl:otherwise>
522
                            </xsl:choose> 
523
                        </xsl:when>
524
                        <xsl:when test="@tag=110 or @tag=710">
525
                           <xsl:choose>
526
                                <xsl:when test="marc:subfield[@code='e']">
527
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='e']"/></xsl:variable>
528
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
529
                                    <xsl:if test="$lastchar != '.'">
530
                                        <xsl:text>.</xsl:text>
531
                                    </xsl:if>
532
                                </xsl:when>
533
                                <xsl:when test="marc:subfield[@code='4']">
534
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='4']"/></xsl:variable>
535
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
536
                                    <xsl:if test="$lastchar != '.'">
537
                                        <xsl:text>.</xsl:text>
538
                                    </xsl:if>
539
                                </xsl:when>
540
                                <xsl:when test="marc:subfield[@code='t'] or marc:subfield[@code='n'] or marc:subfield[@code='d'] or marc:subfield[@code='c']">
541
                                    <xsl:text>.</xsl:text>
542
                                </xsl:when>
543
                                <xsl:otherwise>
544
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable>
545
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
546
                                    <xsl:if test="$lastchar != '.'">
547
                                        <xsl:text>.</xsl:text>
548
                                    </xsl:if>
549
                                </xsl:otherwise>
550
                            </xsl:choose> 
551
                        </xsl:when>
552
                        <xsl:otherwise>
553
                           <xsl:choose>
554
                                <xsl:when test="marc:subfield[@code='j']">
555
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='j']"/></xsl:variable>
556
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
557
                                    <xsl:if test="$lastchar != '.'">
558
                                        <xsl:text>.</xsl:text>
559
                                    </xsl:if>
560
                                </xsl:when>
561
                                <xsl:when test="marc:subfield[@code='4']">
562
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[@code='4']"/></xsl:variable>
563
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
564
                                    <xsl:if test="$lastchar != '.'">
565
                                        <xsl:text>.</xsl:text>
566
                                    </xsl:if>
567
                                </xsl:when>
568
                                <xsl:when test="marc:subfield[@code='t'] or marc:subfield[@code='n'] or marc:subfield[@code='g'] or marc:subfield[@code='d'] or marc:subfield[@code='c']">
569
                                    <xsl:text>.</xsl:text>
570
                                </xsl:when>
571
                                <xsl:otherwise>
572
                                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable>
573
                                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
574
                                    <xsl:if test="$lastchar != '.'">
575
                                        <xsl:text>.</xsl:text>
576
                                    </xsl:if>
577
                                </xsl:otherwise>
578
                            </xsl:choose> 
579
                        </xsl:otherwise>
580
                    </xsl:choose>
581
                </xsl:when>
582
                <xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
474
            </xsl:choose>
583
            </xsl:choose>
475
        </xsl:for-each>
584
        </xsl:for-each>
476
    </p>
585
    </p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl (-1 / +3 lines)
Lines 114-125 Link Here
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:variable name="length" select="string-length($chopString)"/>
118
		<xsl:variable name="length" select="string-length($chopString)"/>
118
		<xsl:choose>
119
		<xsl:choose>
119
			<xsl:when test="$length=0"/>
120
			<xsl:when test="$length=0"/>
120
			<xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
121
			<xsl:when test="contains($punctuation, substring($chopString,$length,1))">
121
				<xsl:call-template name="chopPunctuation">
122
				<xsl:call-template name="chopPunctuation">
122
					<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"/>
123
				</xsl:call-template>
125
				</xsl:call-template>
124
			</xsl:when>
126
			</xsl:when>
125
			<xsl:when test="not($chopString)"/>
127
			<xsl:when test="not($chopString)"/>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl (-1 / +8 lines)
Lines 634-640 Link Here
634
                </span>
634
                </span>
635
            </xsl:if>
635
            </xsl:if>
636
            <xsl:choose>
636
            <xsl:choose>
637
                <xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
637
                <xsl:when test="position()=last()">
638
                    <!-- the test is working but I'm not sure that it's a cood idea to use (global?) variables to do that -->
639
                    <xsl:variable name="lastchain"><xsl:value-of select="marc:subfield[last()]"/></xsl:variable>
640
                    <xsl:variable name="lastchar"><xsl:value-of select="substring($lastchain, string-length($lastchain), 1)"/></xsl:variable>
641
                    <xsl:if test=" ($lastchar != '.') "><xsl:text>.</xsl:text></xsl:if>
642
                </xsl:when>
643
                <xsl:otherwise><span class="separator"><xsl:text> | </xsl:text></span></xsl:otherwise>
638
            </xsl:choose>
644
            </xsl:choose>
639
        </xsl:for-each>
645
        </xsl:for-each>
640
646
Lines 1186-1191 Link Here
1186
                                    <xsl:choose>
1192
                                    <xsl:choose>
1187
                                     <xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
1193
                                     <xsl:when test="($Show856uAsImage='Results' or $Show856uAsImage='Both') and (substring($SubqText,1,6)='image/' or $SubqText='img' or $SubqText='bmp' or $SubqText='cod' or $SubqText='gif' or $SubqText='ief' or $SubqText='jpe' or $SubqText='jpeg' or $SubqText='jpg' or $SubqText='jfif' or $SubqText='png' or $SubqText='svg' or $SubqText='tif' or $SubqText='tiff' or $SubqText='ras' or $SubqText='cmx' or $SubqText='ico' or $SubqText='pnm' or $SubqText='pbm' or $SubqText='pgm' or $SubqText='ppm' or $SubqText='rgb' or $SubqText='xbm' or $SubqText='xpm' or $SubqText='xwd')">
1188
                                        <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text>
1194
                                        <xsl:element name="img"><xsl:attribute name="src"><xsl:value-of select="marc:subfield[@code='u']"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="marc:subfield[@code='y']"/></xsl:attribute><xsl:attribute name="style">height:100px;</xsl:attribute></xsl:element><xsl:text></xsl:text>
1195
1189
                                    </xsl:when>
1196
                                    </xsl:when>
1190
                                    <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1197
                                    <xsl:when test="marc:subfield[@code='y' or @code='3' or @code='z']">
1191
                                        <xsl:call-template name="subfieldSelect">
1198
                                        <xsl:call-template name="subfieldSelect">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl (-2 / +3 lines)
Lines 111-122 Link Here
111
111
112
	<xsl:template name="chopPunctuation">
112
	<xsl:template name="chopPunctuation">
113
		<xsl:param name="chopString"/>
113
		<xsl:param name="chopString"/>
114
		<xsl:param name="punctuation"><xsl:text>.:,;/ </xsl:text></xsl:param>
114
		<xsl:variable name="length" select="string-length($chopString)"/>
115
		<xsl:variable name="length" select="string-length($chopString)"/>
115
		<xsl:choose>
116
		<xsl:choose>
116
			<xsl:when test="$length=0"/>
117
			<xsl:when test="$length=0"/>
117
			<xsl:when test="contains('.:,;/ ', substring($chopString,$length,1))">
118
			<xsl:when test="contains($punctuation, substring($chopString,$length,1))">
118
				<xsl:call-template name="chopPunctuation">
119
				<xsl:call-template name="chopPunctuation">
119
					<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
120
					<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
121
					<xsl:with-param name="punctuation" select="$punctuation"/>
120
				</xsl:call-template>
122
				</xsl:call-template>
121
			</xsl:when>
123
			</xsl:when>
122
			<xsl:when test="not($chopString)"/>
124
			<xsl:when test="not($chopString)"/>
123
- 

Return to bug 28976