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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl (-86 / +22 lines)
Lines 374-462 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" />
Lines 469-476 Link Here
469
        </span>
386
        </span>
470
        <span class="value">
387
        <span class="value">
471
          <xsl:for-each select="marc:datafield[@tag=$tag]">
388
          <xsl:for-each select="marc:datafield[@tag=$tag]">
472
            <xsl:call-template name="tag_onesubject">
389
            <a>
473
            </xsl:call-template>
390
              <xsl:choose>
391
                <xsl:when test="marc:subfield[@code=9]">
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>
393
                </xsl:when>
394
                <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>
396
                </xsl:otherwise>
397
              </xsl:choose>
398
              <xsl:call-template name="chopPunctuation">
399
                <xsl:with-param name="chopString">
400
                  <xsl:call-template name="subfieldSelect">
401
                      <xsl:with-param name="codes">abcdjptvxyz</xsl:with-param>
402
                      <xsl:with-param name="subdivCodes">jpxyz</xsl:with-param>
403
                      <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
404
                  </xsl:call-template>
405
                </xsl:with-param>
406
              </xsl:call-template>
407
            </a>
408
            <xsl:if test="position() != last()">
409
              <xsl:text> | </xsl:text>
410
            </xsl:if>
474
          </xsl:for-each>
411
          </xsl:for-each>
475
        </span>
412
        </span>
476
      </span>
413
      </span>
477
- 

Return to bug 29539