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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl (-109 / +27 lines)
Lines 374-496 Link Here
374
    </xsl:for-each>
374
    </xsl:for-each>
375
  </xsl:template>
375
  </xsl:template>
376
376
377
  <xsl:template name="tag_onesubject">
378
    <xsl:choose>
379
      <xsl:when test="marc:subfield[@code=9]">
380
        <xsl:for-each select="marc:subfield">
381
          <xsl:if test="@code='9'">
382
            <xsl:variable name="start" select="position()"/>
383
            <xsl:variable name="ends">
384
              <xsl:for-each select="../marc:subfield[position() &gt; $start]">
385
                <xsl:if test="@code=9">
386
                  <xsl:variable name="end" select="position() + $start"/>
387
                  <xsl:value-of select="$end"/>
388
                  <xsl:text>,</xsl:text>
389
                </xsl:if>
390
              </xsl:for-each>
391
            </xsl:variable>
392
            <xsl:variable name="end">
393
              <xsl:choose>
394
                <xsl:when test="string-length($ends) > 0">
395
                  <xsl:value-of select="substring-before($ends,',')"/>
396
                </xsl:when>
397
                <xsl:otherwise>
398
                  <xsl:text>1000</xsl:text>
399
                </xsl:otherwise>
400
              </xsl:choose>
401
            </xsl:variable>
402
            <xsl:variable name="display">
403
              <xsl:for-each select="../marc:subfield[position() &gt; $start and position() &lt; $end and @code!=2 and @code!=3]">
404
                <xsl:value-of select="."/>
405
                <xsl:if test="not(position()=last())">
406
                  <xsl:text>, </xsl:text>
407
                </xsl:if>
408
              </xsl:for-each>
409
            </xsl:variable>
410
            <a>
411
              <xsl:attribute name="href">
412
                <xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
413
                <xsl:value-of select="str:encode-uri(., true())"/>
414
              </xsl:attribute>
415
              <xsl:choose>
416
                <xsl:when test="string-length($display) &gt; 0">
417
                  <xsl:call-template name="chopPunctuation">
418
                    <xsl:with-param name="chopString">
419
                      <xsl:value-of select="$display"/>
420
                    </xsl:with-param>
421
                  </xsl:call-template>
422
                </xsl:when>
423
                <xsl:otherwise>
424
                  <xsl:value-of select="."/>
425
                </xsl:otherwise>
426
              </xsl:choose>
427
            </a>
428
            <xsl:variable name="ncommas"
429
                 select="string-length($ends) - string-length(translate($ends, ',', ''))" />
430
            <xsl:if test="$ncommas &gt; 1">
431
              <xsl:text> -- </xsl:text>
432
            </xsl:if>
433
          </xsl:if>
434
        </xsl:for-each>
435
      </xsl:when>
436
      <xsl:when test="marc:subfield[@code='a']">
437
        <a>
438
          <xsl:attribute name="href">
439
            <xsl:text>/cgi-bin/koha/opac-search.pl?q=su:</xsl:text>
440
            <xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>
441
          </xsl:attribute>
442
          <xsl:call-template name="chopPunctuation">
443
            <xsl:with-param name="chopString">
444
              <xsl:call-template name="subfieldSelect">
445
                <xsl:with-param name="codes">abcdfijkmnptvxyz</xsl:with-param>
446
                <xsl:with-param name="subdivCodes">ijknpxyz</xsl:with-param>
447
                <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
448
              </xsl:call-template>
449
            </xsl:with-param>
450
          </xsl:call-template>
451
        </a>
452
      </xsl:when>
453
      <xsl:otherwise/>
454
    </xsl:choose>
455
    <xsl:if test="not(position()=last())">
456
      <xsl:text> | </xsl:text>
457
    </xsl:if>
458
  </xsl:template>
459
460
  <xsl:template name="tag_subject">
377
  <xsl:template name="tag_subject">
461
    <xsl:param name="tag" />
378
    <xsl:param name="tag" />
462
    <xsl:param name="label" />
379
    <xsl:param name="label" />
463
    <xsl:param name="spanclass"/>
380
    <xsl:param name="spanclass" />
464
    <xsl:if test="marc:datafield[@tag=$tag]">
381
    <xsl:if test="marc:datafield[@tag=$tag]">
465
      <span class="results_summary subjects {$spanclass}">
382
      <span class="results_summary subjects {$spanclass}">
466
        <span class="label">
383
        <span class="label">
467
          <xsl:value-of select="$label"/>
384
          <xsl:value-of select="$label"/>
468
          <xsl:text>: </xsl:text>
385
          <xsl:text>: </xsl:text>
469
        </span>
386
        </span>
470
        <xsl:for-each select="marc:datafield[@tag=$tag]">
387
        <span class="value">
471
          <a>
388
          <xsl:for-each select="marc:datafield[@tag=$tag]">
472
            <xsl:choose>
389
            <a>
473
              <xsl:when test="marc:subfield[@code=9]">
390
              <xsl:choose>
474
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
391
                <xsl:when test="marc:subfield[@code=9]">
475
              </xsl:when>
392
                  <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
476
              <xsl:otherwise>
393
                </xsl:when>
477
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
394
                <xsl:otherwise>
478
              </xsl:otherwise>
395
                  <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
479
            </xsl:choose>
396
                </xsl:otherwise>
480
            <xsl:call-template name="chopPunctuation">
397
              </xsl:choose>
481
              <xsl:with-param name="chopString">
398
              <xsl:call-template name="chopPunctuation">
482
                <xsl:call-template name="subfieldSelect">
399
                <xsl:with-param name="chopString">
483
                    <xsl:with-param name="codes">abcdjptvxyz</xsl:with-param>
400
                  <xsl:call-template name="subfieldSelect">
484
                    <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param>
401
                      <xsl:with-param name="codes">abcdjptvxyz</xsl:with-param>
485
                    <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
402
                      <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param>
486
                </xsl:call-template>
403
                      <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
487
              </xsl:with-param>
404
                  </xsl:call-template>
488
            </xsl:call-template>
405
                </xsl:with-param>
489
          </a>
406
              </xsl:call-template>
490
          <xsl:if test="not (position()=last())">
407
            </a>
491
            <xsl:text> | </xsl:text>
408
            <xsl:if test="position() != last()">
492
          </xsl:if>
409
              <xsl:text> | </xsl:text>
493
        </xsl:for-each>
410
            </xsl:if>
411
          </xsl:for-each>
412
        </span>
494
      </span>
413
      </span>
495
    </xsl:if>
414
    </xsl:if>
496
  </xsl:template>
415
  </xsl:template>
497
- 

Return to bug 29539