1 <?xml version="1.0" encoding="utf-8"?>
4 The contents of this file are subject to the license and copyright
5 detailed in the LICENSE and NOTICE files at the root of the source
6 tree and available online at
8 http://www.dspace.org/license/
11 <xsl:stylesheet version="1.0"
12 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oai="http://www.openarchives.org/OAI/2.0/"
13 xmlns:koha="http://koha-community.org" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
14 xmlns:dc="http://purl.org/dc/doc:elements/1.1/" xmlns:marc="http://www.loc.gov/MARC21/slim"
15 xmlns:verb="http://informatik.hu-berlin.de/xmlverbatim"
16 xmlns:oai_id="http://www.openarchives.org/OAI/2.0/oai-identifier"
17 exclude-result-prefixes="oai oai_dc dc marc marcxml verb oai_id">
19 <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
21 <xsl:template match="/">
24 <title>Koha OAI-PMH Data Provider</title>
25 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
26 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
27 <script src="/opac-tmpl/bootstrap/lib/jquery/jquery.js" type="text/javascript" />
28 <script src="/opac-tmpl/bootstrap/lib/bootstrap/js/bootstrap.min.js" type="text/javascript" />
29 <link rel="stylesheet" href="/opac-tmpl/bootstrap/css/bootstrap-theme-oai.css" type="text/css" />
30 <link rel="stylesheet" href="/opac-tmpl/bootstrap/css/oai.css" type="text/css" />
33 <div class="container">
34 <div class="navbar navbar-default" role="navigation">
35 <div class="navbar-header">
36 <a class="navbar-brand" href="#">Koha OAI-PMH Data Provider</a>
38 <div class="navbar-collapse collapse">
39 <ul class="nav navbar-nav navbar-right">
41 <a title="Institutional information">
42 <xsl:if test="/oai:OAI-PMH/oai:request/@verb = 'Identify'">
43 <xsl:attribute name="class">active</xsl:attribute>
45 <xsl:attribute name="href">
47 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=Identify')"></xsl:value-of>
53 <a title="Listing available sets">
54 <xsl:if test="/oai:OAI-PMH/oai:request/@verb = 'ListSets'">
55 <xsl:attribute name="class">active</xsl:attribute>
57 <xsl:attribute name="href">
59 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListSets')"></xsl:value-of>
65 <a title="Listing records (with metadata)">
66 <xsl:if test="/oai:OAI-PMH/oai:request/@verb = 'ListRecords'">
67 <xsl:attribute name="class">active</xsl:attribute>
69 <xsl:attribute name="href">
71 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc')"></xsl:value-of>
77 <a title="Listing identifiers only">
78 <xsl:if test="/oai:OAI-PMH/oai:request/@verb = 'ListIdentifiers'">
79 <xsl:attribute name="class">active</xsl:attribute>
81 <xsl:attribute name="href">
83 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListIdentifiers&metadataPrefix=oai_dc')"></xsl:value-of>
89 <a title="Metadata Formats available">
91 test="/oai:OAI-PMH/oai:request/@verb = 'ListMetadataFormats'">
92 <xsl:attribute name="class">active</xsl:attribute>
94 <xsl:attribute name="href">
96 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListMetadataFormats')"></xsl:value-of>
102 </div><!--/.nav-collapse -->
105 <div class="col-lg-offset-1 col-lg-10">
107 <h5>Response Date <small><xsl:value-of select="translate(oai:OAI-PMH/oai:responseDate/text(), 'TZ', ' ')" /></small></h5>
110 <xsl:apply-templates select="oai:OAI-PMH/oai:error" />
111 <xsl:apply-templates select="oai:OAI-PMH/oai:Identify" />
112 <xsl:apply-templates select="oai:OAI-PMH/oai:ListSets" />
113 <xsl:apply-templates select="oai:OAI-PMH/oai:ListRecords" />
114 <xsl:apply-templates select="oai:OAI-PMH/oai:ListIdentifiers" />
115 <xsl:apply-templates select="oai:OAI-PMH/oai:ListMetadataFormats" />
116 <xsl:apply-templates select="oai:OAI-PMH/oai:GetRecord" />
121 <div class="row-fluid text-center">
122 <div class="vertical-space"></div>
123 <p><small>Powered by <a href="http://koha-community.org">Koha</a></small></p>
130 <xsl:template match="oai:OAI-PMH/oai:error">
131 <div class="alert alert-danger">
134 <xsl:value-of select="text()"></xsl:value-of>
139 <xsl:template match="oai:OAI-PMH/oai:Identify">
140 <h2>Repository Information</h2>
142 <table class="table table-striped table-bordered">
144 <td><b>Repository Name</b></td>
145 <td><xsl:value-of select="oai:repositoryName/text()" /></td>
147 <xsl:for-each select="oai:adminEmail">
149 <td><b>E-Mail Contact</b></td>
152 <xsl:attribute name="href">
153 <xsl:value-of select="concat('mailto:', text())" />
155 <xsl:value-of select="text()" />
161 <td><b>Repository identifier</b></td>
163 <xsl:value-of select="oai:description/oai_id:oai-identifier/oai_id:repositoryIdentifier/text()" />
167 <td><b>Sample identifier</b></td>
170 select="oai:description/oai_id:oai-identifier/oai_id:sampleIdentifier/text()" />
174 <td><b>Protocol Version</b></td>
177 select="oai:protocolVersion/text()" />
182 <td><b>Earliest Registered Date</b></td>
185 select="translate(oai:earliestDatestamp/text(), 'TZ' ,' ')" />
190 <td><b>Date Granularity</b></td>
193 select="translate(oai:granularity/text(), 'TZ', ' ')" />
198 <td><b>Deletion Mode</b></td>
201 select="oai:deletedRecord/text()" />
208 <xsl:template match="oai:OAI-PMH/oai:ListSets">
209 <h2>List of Sets</h2>
211 <div class="well well-sm">
214 <xsl:call-template name="result-count">
215 <xsl:with-param name="path" select="oai:set" />
220 <div class="list-group">
221 <xsl:for-each select="oai:set">
222 <div class="list-group-item">
223 <h5 class="list-group-item-heading">
225 <xsl:when test="string-length(oai:setName/text()) > 83">
226 <xsl:value-of select="substring(oai:setName/text(),0, 80 )" />
230 <xsl:value-of select="oai:setName/text()" />
234 [<xsl:value-of select="oai:setSpec/text()" />]
239 <xsl:attribute name="href">
241 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', oai:setSpec/text())" />
246 <xsl:attribute name="href">
248 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListIdentifiers&metadataPrefix=oai_dc&set=', oai:setSpec/text())" />
257 <xsl:apply-templates select="oai:resumptionToken"/>
260 <xsl:template match="oai:OAI-PMH/oai:ListRecords">
261 <h2>List of Records</h2>
263 <div class="well well-sm">
266 <xsl:call-template name="result-count">
267 <xsl:with-param name="path" select="oai:record" />
272 <xsl:for-each select="oai:record">
273 <div class="panel panel-default">
274 <div class="panel-heading">
276 <div class="col-lg-6">
277 <h5>Identifier <small><xsl:value-of select="oai:header/oai:identifier/text()"></xsl:value-of></small></h5>
279 <div class="col-lg-6">
280 <h5>Last Modified <small><xsl:value-of select="translate(oai:header/oai:datestamp/text(), 'TZ', ' ')"></xsl:value-of></small></h5>
284 <div class="panel-body">
285 <!-- If this record has a "status", display it as a warning -->
286 <xsl:if test="oai:header/@status">
287 <div class="alert alert-warning">Record Status: <xsl:value-of select="oai:header/@status"/></div>
289 <div class="panel panel-success">
290 <a data-toggle="collapse">
291 <xsl:attribute name="href">#sets<xsl:value-of select="translate(oai:header/oai:identifier/text(), ':/.', '')"></xsl:value-of></xsl:attribute>
292 <div class="panel-heading">
293 <h5 class="panel-title">
298 <div class="panel-collapse collapse">
299 <xsl:attribute name="id">sets<xsl:value-of select="translate(oai:header/oai:identifier/text(), ':/.', '')"></xsl:value-of></xsl:attribute>
300 <div class="panel-body list-group">
301 <xsl:for-each select="oai:header/oai:setSpec">
302 <div class="list-group-item">
304 <xsl:attribute name="href">
306 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" />
308 <xsl:value-of select="text()" />
315 <div class="panel panel-info">
316 <a data-toggle="collapse">
317 <xsl:attribute name="href">#<xsl:value-of select="translate(oai:header/oai:identifier/text(), ':/.', '')"></xsl:value-of></xsl:attribute>
318 <div class="panel-heading">
319 <h5 class="panel-title">
324 <div class="panel-collapse collapse">
325 <xsl:attribute name="id"><xsl:value-of select="translate(oai:header/oai:identifier/text(), ':/.', '')"></xsl:value-of></xsl:attribute>
326 <div class="panel-body">
327 <xsl:apply-templates select="oai:metadata/*" />
335 <xsl:apply-templates select="oai:resumptionToken"/>
338 <xsl:template match="oai:OAI-PMH/oai:GetRecord">
339 <h2>Record Details</h2>
341 <xsl:for-each select="oai:record">
342 <div class="panel panel-default">
343 <div class="panel-heading">
345 <div class="col-lg-6">
346 <h5>Identifier <small><xsl:value-of select="oai:header/oai:identifier/text()"></xsl:value-of></small></h5>
348 <div class="col-lg-6">
349 <h5>Last Modified <small><xsl:value-of select="translate(oai:header/oai:datestamp/text(), 'TZ', ' ')"></xsl:value-of></small></h5>
353 <div class="panel-body">
354 <!-- If this record has a "status", display it as a warning -->
355 <xsl:if test="oai:header/@status">
356 <div class="alert alert-warning">Record Status: <xsl:value-of select="oai:header/@status"/></div>
358 <div class="panel panel-success">
359 <div class="panel-heading">
360 <h5 class="panel-title">
364 <div class="panel-body list-group">
365 <xsl:for-each select="oai:header/oai:setSpec">
366 <div class="list-group-item">
368 <xsl:attribute name="href">
370 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" />
372 <xsl:value-of select="text()" />
378 <div class="panel panel-info">
379 <div class="panel-heading">
380 <h5 class="panel-title">
384 <div class="panel-body">
385 <xsl:apply-templates select="oai:metadata/*" />
393 <xsl:template match="oai:OAI-PMH/oai:ListIdentifiers">
394 <h2>List of Identifiers</h2>
396 <div class="well well-sm">
399 <xsl:call-template name="result-count">
400 <xsl:with-param name="path" select="oai:header" />
405 <xsl:for-each select="oai:header">
406 <div class="panel panel-default">
407 <div class="panel-heading">
409 <div class="col-lg-4">
410 <h5>Identifier <small><xsl:value-of select="oai:identifier/text()"></xsl:value-of></small></h5>
412 <div class="col-lg-4">
413 <h5>Last Modified <small><xsl:value-of select="translate(oai:datestamp/text(), 'TZ', ' ')"></xsl:value-of></small></h5>
415 <div class="col-lg-4">
416 <a class="btn btn-default pull-right">
417 <xsl:attribute name="href">
418 <xsl:value-of select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=GetRecord&metadataPrefix=oai_dc&identifier=', oai:identifier/text())" />
425 <div class="panel-body">
426 <!-- If this record has a "status", display it as a warning -->
427 <xsl:if test="@status">
428 <div class="alert alert-warning">Record Status: <xsl:value-of select="@status"/></div>
430 <div class="panel panel-success">
431 <a data-toggle="collapse">
432 <xsl:attribute name="href">#sets<xsl:value-of select="translate(oai:identifier/text(), ':/.', '')"></xsl:value-of></xsl:attribute>
433 <div class="panel-heading">
434 <h5 class="panel-title">
439 <div class="panel-collapse collapse">
440 <xsl:attribute name="id">sets<xsl:value-of select="translate(oai:identifier/text(), ':/.', '')"></xsl:value-of></xsl:attribute>
441 <div class="panel-body list-group">
442 <xsl:for-each select="oai:setSpec">
443 <div class="list-group-item">
445 <xsl:attribute name="href">
447 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" />
449 <xsl:value-of select="text()" />
460 <xsl:apply-templates select="oai:resumptionToken"/>
463 <xsl:template match="oai:OAI-PMH/oai:ListMetadataFormats">
464 <h2>List of Metadata Formats</h2>
466 <div class="well well-sm">
469 <xsl:value-of select="count(oai:OAI-PMH/oai:ListMetadataFormats/oai:metadataFormat)" />
473 <xsl:for-each select="oai:metadataFormat">
474 <div class="panel panel-default">
475 <div class="panel-heading">
477 <div class="col-lg-9">
478 <h5><xsl:value-of select="oai:metadataPrefix/text()"></xsl:value-of></h5>
480 <div class="col-lg-3">
481 <a class="btn btn-default pull-right">
482 <xsl:attribute name="href">
484 select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=ListRecords&metadataPrefix=', oai:metadataPrefix/text())" />
491 <div class="panel-body">
493 <div class="col-lg-9">
494 <h5>Namespace <small><xsl:value-of select="oai:metadataNamespace/text()"></xsl:value-of></small></h5>
495 <h5>Schema <small><xsl:value-of select="oai:schema/text()"></xsl:value-of></small></h5>
503 <xsl:template match="oai:resumptionToken">
504 <xsl:if test="text() != ''">
505 <div class="text-center">
506 <a class="btn btn-primary">
507 <xsl:attribute name="href">
508 <xsl:value-of select="concat(/oai:OAI-PMH/oai:request/text(), '?verb=',/oai:OAI-PMH/oai:request/@verb,'&resumptionToken=', text())"></xsl:value-of>
516 <xsl:template name="result-count">
517 <xsl:param name="path" />
518 <xsl:variable name="cursor" select="$path/../oai:resumptionToken/@cursor" />
519 <xsl:variable name="count" select="count($path)" />
520 <xsl:variable name="total" select="$path/../oai:resumptionToken/@completeListSize" />
522 <xsl:when test="$cursor">
524 <xsl:when test="normalize-space($path/../oai:resumptionToken/text()) = ''">
525 <!-- on the last page of results we have to assume that @completeListSize is available -->
527 select="$total - $count" />
529 <xsl:value-of select="$total" />
532 <xsl:value-of select="$cursor * $count" />
534 <xsl:value-of select="($cursor+1) * $count" />
539 <xsl:value-of select="$count" />
542 <xsl:if test="$total">
544 <xsl:value-of select="$total" />
548 <xsl:template match="oai:metadata/*" priority='-20'>
549 <xsl:apply-templates select="." mode='xmlverb' />
552 <xsl:param name="indent-elements" select="false()" />
554 <xsl:template match="/" mode="xmlverb">
555 <xsl:text>
</xsl:text>
557 <xsl:text> converted by xmlverbatim.xsl 1.1, (c) O. Becker </xsl:text>
559 <xsl:text>
</xsl:text>
560 <div class="xmlverb-default">
561 <xsl:apply-templates mode="xmlverb">
562 <xsl:with-param name="indent-elements" select="$indent-elements" />
563 </xsl:apply-templates>
565 <xsl:text>
</xsl:text>
569 <xsl:template match="verb:wrapper">
570 <xsl:apply-templates mode="xmlverb">
571 <xsl:with-param name="indent-elements" select="$indent-elements" />
572 </xsl:apply-templates>
575 <xsl:template match="verb:wrapper" mode="xmlverb">
576 <xsl:apply-templates mode="xmlverb">
577 <xsl:with-param name="indent-elements" select="$indent-elements" />
578 </xsl:apply-templates>
581 <!-- element nodes -->
582 <xsl:template match="*" mode="xmlverb">
583 <xsl:param name="indent-elements" select="true()" />
584 <xsl:param name="indent" select="''" />
585 <xsl:param name="indent-increment" select="'   '" />
586 <xsl:if test="$indent-elements">
588 <xsl:value-of select="$indent" />
590 <xsl:text><</xsl:text>
591 <xsl:variable name="ns-prefix"
592 select="substring-before(name(),':')" />
593 <xsl:if test="$ns-prefix != ''">
594 <span class="xmlverb-element-nsprefix">
595 <xsl:value-of select="$ns-prefix"/>
597 <xsl:text>:</xsl:text>
599 <span class="xmlverb-element-name">
600 <xsl:value-of select="local-name()"/>
602 <xsl:variable name="pns" select="../namespace::*"/>
603 <xsl:if test="$pns[name()=''] and not(namespace::*[name()=''])">
604 <span class="xmlverb-ns-name">
605 <xsl:text> xmlns</xsl:text>
607 <xsl:text>=""</xsl:text>
609 <xsl:for-each select="namespace::*">
610 <xsl:if test="not($pns[name()=name(current()) and
612 <xsl:call-template name="xmlverb-ns" />
615 <xsl:for-each select="@*">
616 <xsl:call-template name="xmlverb-attrs" />
619 <xsl:when test="node()">
620 <xsl:text>></xsl:text>
621 <xsl:apply-templates mode="xmlverb">
622 <xsl:with-param name="indent-elements"
623 select="$indent-elements"/>
624 <xsl:with-param name="indent"
625 select="concat($indent, $indent-increment)"/>
626 <xsl:with-param name="indent-increment"
627 select="$indent-increment"/>
628 </xsl:apply-templates>
629 <xsl:if test="* and $indent-elements">
631 <xsl:value-of select="$indent" />
633 <xsl:text></</xsl:text>
634 <xsl:if test="$ns-prefix != ''">
635 <span class="xmlverb-element-nsprefix">
636 <xsl:value-of select="$ns-prefix"/>
638 <xsl:text>:</xsl:text>
640 <span class="xmlverb-element-name">
641 <xsl:value-of select="local-name()"/>
643 <xsl:text>></xsl:text>
646 <xsl:text> /></xsl:text>
649 <xsl:if test="not(parent::*)"><br /><xsl:text>
</xsl:text></xsl:if>
652 <!-- attribute nodes -->
653 <xsl:template name="xmlverb-attrs">
654 <xsl:text> </xsl:text>
655 <span class="xmlverb-attr-name">
656 <xsl:value-of select="name()"/>
658 <xsl:text>="</xsl:text>
659 <span class="xmlverb-attr-content">
660 <xsl:call-template name="html-replace-entities">
661 <xsl:with-param name="text" select="normalize-space(.)" />
662 <xsl:with-param name="attrs" select="true()" />
665 <xsl:text>"</xsl:text>
668 <!-- namespace nodes -->
669 <xsl:template name="xmlverb-ns">
670 <xsl:if test="name()!='xml'">
671 <span class="xmlverb-ns-name">
672 <xsl:text> xmlns</xsl:text>
673 <xsl:if test="name()!=''">
674 <xsl:text>:</xsl:text>
676 <xsl:value-of select="name()"/>
678 <xsl:text>="</xsl:text>
679 <span class="xmlverb-ns-uri">
680 <xsl:value-of select="."/>
682 <xsl:text>"</xsl:text>
687 <xsl:template match="text()" mode="xmlverb">
688 <span class="xmlverb-text">
689 <xsl:call-template name="preformatted-output">
690 <xsl:with-param name="text">
691 <xsl:call-template name="html-replace-entities">
692 <xsl:with-param name="text" select="." />
700 <xsl:template match="comment()" mode="xmlverb">
701 <xsl:text><!--</xsl:text>
702 <span class="xmlverb-comment">
703 <xsl:call-template name="preformatted-output">
704 <xsl:with-param name="text" select="." />
707 <xsl:text>--></xsl:text>
708 <xsl:if test="not(parent::*)"><br /><xsl:text>
</xsl:text></xsl:if>
711 <!-- processing instructions -->
712 <xsl:template match="processing-instruction()" mode="xmlverb">
713 <xsl:text><?</xsl:text>
714 <span class="xmlverb-pi-name">
715 <xsl:value-of select="name()"/>
717 <xsl:if test=".!=''">
718 <xsl:text> </xsl:text>
719 <span class="xmlverb-pi-content">
720 <xsl:value-of select="."/>
723 <xsl:text>?></xsl:text>
724 <xsl:if test="not(parent::*)"><br /><xsl:text>
</xsl:text></xsl:if>
728 <!-- =========================================================== -->
729 <!-- Procedures / Functions -->
730 <!-- =========================================================== -->
732 <!-- generate entities by replacing &, ", < and > in $text -->
733 <xsl:template name="html-replace-entities">
734 <xsl:param name="text" />
735 <xsl:param name="attrs" />
736 <xsl:variable name="tmp">
737 <xsl:call-template name="replace-substring">
738 <xsl:with-param name="from" select="'>'" />
739 <xsl:with-param name="to" select="'&gt;'" />
740 <xsl:with-param name="value">
741 <xsl:call-template name="replace-substring">
742 <xsl:with-param name="from" select="'<'" />
743 <xsl:with-param name="to" select="'&lt;'" />
744 <xsl:with-param name="value">
745 <xsl:call-template name="replace-substring">
746 <xsl:with-param name="from"
748 <xsl:with-param name="to"
749 select="'&amp;'" />
750 <xsl:with-param name="value"
759 <!-- $text is an attribute value -->
760 <xsl:when test="$attrs">
761 <xsl:call-template name="replace-substring">
762 <xsl:with-param name="from" select="'
'" />
763 <xsl:with-param name="to" select="'&#xA;'" />
764 <xsl:with-param name="value">
765 <xsl:call-template name="replace-substring">
766 <xsl:with-param name="from"
768 <xsl:with-param name="to"
769 select="'&quot;'" />
770 <xsl:with-param name="value" select="$tmp" />
776 <xsl:value-of select="$tmp" />
781 <!-- replace in $value substring $from with $to -->
782 <xsl:template name="replace-substring">
783 <xsl:param name="value" />
784 <xsl:param name="from" />
785 <xsl:param name="to" />
787 <xsl:when test="contains($value,$from)">
788 <xsl:value-of select="substring-before($value,$from)" />
789 <xsl:value-of select="$to" />
790 <xsl:call-template name="replace-substring">
791 <xsl:with-param name="value"
792 select="substring-after($value,$from)" />
793 <xsl:with-param name="from" select="$from" />
794 <xsl:with-param name="to" select="$to" />
798 <xsl:value-of select="$value" />
803 <!-- preformatted output: space as , tab as 8
805 <xsl:template name="preformatted-output">
806 <xsl:param name="text" />
807 <xsl:call-template name="output-nl">
808 <xsl:with-param name="text">
809 <xsl:call-template name="replace-substring">
810 <xsl:with-param name="value"
811 select="translate($text,' ',' ')" />
812 <xsl:with-param name="from" select="'	'" />
813 <xsl:with-param name="to"
814 select="'        '" />
820 <!-- output nl as <br> -->
821 <xsl:template name="output-nl">
822 <xsl:param name="text" />
824 <xsl:when test="contains($text,'
')">
825 <xsl:value-of select="substring-before($text,'
')" />
827 <xsl:text>
</xsl:text>
828 <xsl:call-template name="output-nl">
829 <xsl:with-param name="text"
830 select="substring-after($text,'
')" />
834 <xsl:value-of select="$text" />