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

(-)a/C4/XSLT.pm (-5 / +7 lines)
Lines 240-246 sub XSLTParse4Display { Link Here
240
            $variables->{OpenURLResolverURL} = $biblio->get_openurl;
240
            $variables->{OpenURLResolverURL} = $biblio->get_openurl;
241
        }
241
        }
242
    }
242
    }
243
    my $extracontentxml = '';
243
    my $extracontent = '';
244
244
245
    # Check if we should add extra content based on system preference
245
    # Check if we should add extra content based on system preference
246
    if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) {
246
    if ( C4::Context->preference('ExtraContentForXSLTDisplay') ) {
Lines 248-255 sub XSLTParse4Display { Link Here
248
        my $scrubber               = C4::Scrubber->new('staff');
248
        my $scrubber               = C4::Scrubber->new('staff');
249
        my $extracontentvalue      = C4::Context->preference('ExtraContentForXSLTDisplay');
249
        my $extracontentvalue      = C4::Context->preference('ExtraContentForXSLTDisplay');
250
        my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } );
250
        my $extracontentproccessed = process_tt( $extracontentvalue, { record => $record } );
251
        my $cleanxml               = $scrubber->scrub($extracontentproccessed);
251
        $extracontent = $scrubber->scrub($extracontentproccessed);
252
        $extracontentxml = qq{<extracontent><content>$cleanxml</content></extracontent>};
253
    }
252
    }
254
253
255
    # embed variables
254
    # embed variables
Lines 261-267 sub XSLTParse4Display { Link Here
261
    $varxml .= "</variables>\n";
260
    $varxml .= "</variables>\n";
262
261
263
    my $sysxml = get_xslt_sysprefs();
262
    my $sysxml = get_xslt_sysprefs();
264
    $xmlrecord =~ s/\<\/record\>/$itemsxml$extracontentxml$sysxml$varxml\<\/record\>/;
263
    $xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/;
265
    if ($fixamps) {    # We need to correct the ampersand entities that Zebra outputs
264
    if ($fixamps) {    # We need to correct the ampersand entities that Zebra outputs
266
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
265
        $xmlrecord =~ s/\&amp;amp;/\&amp;/g;
267
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
266
        $xmlrecord =~ s/\&amp\;lt\;/\&lt\;/g;
Lines 273-279 sub XSLTParse4Display { Link Here
273
    #If the xslt should fail, we will return undef (old behavior was
272
    #If the xslt should fail, we will return undef (old behavior was
274
    #raw MARC)
273
    #raw MARC)
275
    #Note that we did set do_not_return_source at object construction
274
    #Note that we did set do_not_return_source at object construction
276
    return $engine->transform( $xmlrecord, $xslfilename );    #file or URL
275
    my $transformed_xml = $engine->transform( $xmlrecord, $xslfilename );
276
277
    my $concatenated_content = $transformed_xml . $extracontent;
278
    return $concatenated_content;
277
}
279
}
278
280
279
=head2 buildKohaItemsNamespace
281
=head2 buildKohaItemsNamespace
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-37 lines)
Lines 14-37 Link Here
14
    <xsl:template match="/">
14
    <xsl:template match="/">
15
            <xsl:apply-templates/>
15
            <xsl:apply-templates/>
16
    </xsl:template>
16
    </xsl:template>
17
    <!-- Template for adding custom content from ExtraContentForXSLTDisplay and preserving HTML and TT from the preference -->
18
    <xsl:template match="marc:extracontent//node()">
19
      <xsl:choose>
20
        <xsl:when test="self::text() or self::comment()">
21
          <xsl:value-of select="."/>
22
        </xsl:when>
23
        <xsl:otherwise>
24
          <xsl:element name="{local-name()}">
25
            <xsl:for-each select="@*">
26
              <xsl:attribute name="{name()}">
27
                <xsl:value-of select="."/>
28
              </xsl:attribute>
29
            </xsl:for-each>
30
            <xsl:apply-templates select="node()"/>
31
          </xsl:element>
32
        </xsl:otherwise>
33
      </xsl:choose>
34
    </xsl:template>
35
    <xsl:template match="marc:record">
17
    <xsl:template match="marc:record">
36
18
37
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
19
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
Lines 1586-1610 Link Here
1586
        </span>
1568
        </span>
1587
        </xsl:if>
1569
        </xsl:if>
1588
1570
1589
        <!-- Process custom fields from  ExtraContentForXSLTDisplay system preference -->
1590
        <xsl:for-each select="marc:extracontent/marc:content/node()">
1591
          <xsl:choose>
1592
            <xsl:when test="self::text() or self::comment()">
1593
              <xsl:value-of select="."/>
1594
            </xsl:when>
1595
            <xsl:otherwise>
1596
              <xsl:element name="{local-name()}">
1597
                <xsl:for-each select="@*">
1598
                  <xsl:attribute name="{name()}">
1599
                    <xsl:value-of select="."/>
1600
                  </xsl:attribute>
1601
                </xsl:for-each>
1602
                <xsl:apply-templates select="node()"/>
1603
              </xsl:element>
1604
            </xsl:otherwise>
1605
          </xsl:choose>
1606
        </xsl:for-each>
1607
1608
        <!-- Indicate if record is suppressed in OPAC -->
1571
        <!-- Indicate if record is suppressed in OPAC -->
1609
        <xsl:choose>
1572
        <xsl:choose>
1610
            <xsl:when test="$OpacSuppression = 1 and marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']">
1573
            <xsl:when test="$OpacSuppression = 1 and marc:datafield[@tag=942][marc:subfield[@code='n'] = '1']">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl (-37 lines)
Lines 12-35 Link Here
12
    <xsl:template match="/">
12
    <xsl:template match="/">
13
            <xsl:apply-templates/>
13
            <xsl:apply-templates/>
14
    </xsl:template>
14
    </xsl:template>
15
    <!-- Template for adding custom content from ExtraContentForXSLTDisplay and preserving HTML and TT from the preference -->
16
    <xsl:template match="marc:extracontent//node()">
17
      <xsl:choose>
18
        <xsl:when test="self::text() or self::comment()">
19
          <xsl:value-of select="."/>
20
        </xsl:when>
21
        <xsl:otherwise>
22
          <xsl:element name="{local-name()}">
23
            <xsl:for-each select="@*">
24
              <xsl:attribute name="{name()}">
25
                <xsl:value-of select="."/>
26
              </xsl:attribute>
27
            </xsl:for-each>
28
            <xsl:apply-templates select="node()"/>
29
          </xsl:element>
30
        </xsl:otherwise>
31
      </xsl:choose>
32
    </xsl:template>
33
    <xsl:template match="marc:record">
15
    <xsl:template match="marc:record">
34
16
35
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
17
        <!-- Option: Display Alternate Graphic Representation (MARC 880)  -->
Lines 1039-1062 Link Here
1039
        </span>
1021
        </span>
1040
        </xsl:if>
1022
        </xsl:if>
1041
    </xsl:if>
1023
    </xsl:if>
1042
    <!-- Process custom fields from  ExtraContentForXSLTDisplay system preference -->
1043
    <xsl:for-each select="marc:extracontent/marc:content/node()">
1044
      <xsl:choose>
1045
        <xsl:when test="self::text() or self::comment()">
1046
          <xsl:value-of select="."/>
1047
        </xsl:when>
1048
        <xsl:otherwise>
1049
          <xsl:element name="{local-name()}">
1050
            <xsl:for-each select="@*">
1051
              <xsl:attribute name="{name()}">
1052
                <xsl:value-of select="."/>
1053
              </xsl:attribute>
1054
            </xsl:for-each>
1055
            <xsl:apply-templates select="node()"/>
1056
          </xsl:element>
1057
        </xsl:otherwise>
1058
      </xsl:choose>
1059
    </xsl:for-each>
1060
1024
1061
    <!-- Content Warning -->
1025
    <!-- Content Warning -->
1062
    <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/>
1026
    <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/>
1063
- 

Return to bug 39860