# XSLT processing of some stuff
if (C4::Context->preference("XSLTResultsDisplay") ) {
- my $newxmlrecord = XSLTParse4Display($oldbiblio->{biblionumber},'Results');
+ my $newxmlrecord = XSLTParse4Display($oldbiblio->{biblionumber},C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACResults.xsl");
$oldbiblio->{XSLTResultsRecord} = $newxmlrecord;
}
}
sub XSLTParse4Display {
- my ($biblionumber,$type) = @_;
+ my ($biblionumber,$xslfile) = @_;
# grab the XML, run it through our stylesheet, push it out to the browser
my $record = transformMARCXML4XSLT($biblionumber);
my $itemsxml = buildKohaItemsNamespace($biblionumber);
my $xmlrecord = $record->as_xml();
$xmlrecord =~ s/\<\/record\>/$itemsxml\<\/record\>/;
- my $xslfile = C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPAC$type.xsl";
my $parser = XML::LibXML->new();
# don't die when you find &, >, etc
$parser->recover_silently(1);
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">ab</xsl:with-param>
</xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</xsl:variable>
<img src="/opac-tmpl/prog/famfamfam/{$materialTypeCode}.png"/><xsl:value-of select="$materialTypeLabel"/>
</p>
</xsl:if>
- <xsl:if test="$lcc">
+ <xsl:if test="marc:datafield[@tag=050]">
<p><span class="label">Library of Congress Classification: </span>
<xsl:value-of select="$lcc"/>
</p>
</xsl:if>
<xsl:if test="marc:datafield[@tag=020]">
<p><span class="label">ISBN: </span>
+ <!-- unAPI <abbr/> tag -->
<xsl:for-each select="marc:datafield[@tag=020]">
- <xsl:value-of select="marc:subfield[@code='a']"/>
+ <xsl:variable name="isbn" select="marc:subfield[@code='a']"/>
+ <abbr class="unapi-id" title="koha:isbn:{$isbn}"><xsl:value-of select="marc:subfield[@code='a']"/></abbr>
<xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</p>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">ab</xsl:with-param>
</xsl:call-template>
+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>.</xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
</xsl:for-each>
</xsl:variable>
<td style="vertical-align:top;">
$template->param( biblionumber => $biblionumber );
# XSLT processing of some stuff
if (C4::Context->preference("XSLTResultsDisplay") ) {
- my $newxmlrecord = XSLTParse4Display($biblionumber,'Detail');
+ my $newxmlrecord = XSLTParse4Display($biblionumber,C4::Context->config('opachtdocs')."/prog/en/xslt/MARC21slim2OPACDetail.xsl");
$template->param('XSLTBloc' => $newxmlrecord);
}
my $id = $cgi->param('id');
my $format = $cgi->param('format');
if ($id && $format) {
+
# koha:isbn:0152018484
if ($id =~ /isbn/) {
$id =~ s/koha:isbn://;
+
+ # two ways to do this, one via the SRU Zebra server (fast)
my $url = "http://$baseurl:9998/biblios?version=1.1&operation=searchRetrieve&query=$id&startRecord=1&maximumRecords=20&recordSchema=$format";
- my $content = get($url);
+ my $content= get($url);
+
+ # the other via XSL parsing (not as fast)
+ unless ($content) {
+
+ eval {
+ my $conn = C4::Context->Zconn('biblioserver');
+ $conn->option(preferredRecordSyntax => $format);
+ my $rs = $conn->search_pqf('@attr 1=7 '.$id);
+ my $n = $rs->size();
+ $content = $rs->record(0)->raw();
+ };
+ if ($@) {
+ print "Error ", $@->code(), ": ", $@->message(), "\n";
+ }
+
+ }
print $cgi->header( -type =>'application/xml' );
print $content;
}