blacklight_oai_provider 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -24,8 +24,9 @@ Then run "rails generate blacklight_oai_provider" to install the appropriate ext
24
24
 
25
25
  use_extension(BlacklightOaiProvider::SolrDocumentExtension)
26
26
 
27
- - add this to your Controler:
27
+ - add this to your Controller:
28
28
 
29
+ include BlacklightOaiProvider::ControllerExtension
29
30
 
30
31
 
31
32
  = Configuration
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -0,0 +1,659 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+
3
+ <!--
4
+
5
+ XSL Transform to convert OAI 2.0 responses into XHTML
6
+
7
+ By Christopher Gutteridge, University of Southampton
8
+
9
+ -->
10
+
11
+ <!--
12
+
13
+ Copyright (c) 2000-2004 University of Southampton, UK. SO17 1BJ.
14
+
15
+ EPrints 2 is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ EPrints 2 is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with EPrints 2; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+
29
+ -->
30
+
31
+
32
+ <!--
33
+
34
+ All the elements really needed for EPrints are done but if
35
+ you want to use this XSL for other OAI archive you may want
36
+ to make some minor changes or additions.
37
+
38
+ Not Done
39
+ The 'about' section of 'record'
40
+ The 'compession' part of 'identify'
41
+ The optional attributes of 'resumptionToken'
42
+ The optional 'setDescription' container of 'set'
43
+
44
+ All the links just link to oai_dc versions of records.
45
+
46
+ -->
47
+ <xsl:stylesheet
48
+ version="1.0"
49
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
50
+ xmlns:oai="http://www.openarchives.org/OAI/2.0/"
51
+ >
52
+
53
+ <xsl:output method="html"/>
54
+
55
+
56
+
57
+ <xsl:template name="style">
58
+ td.value {
59
+ vertical-align: top;
60
+ padding-left: 1em;
61
+ padding: 3px;
62
+ }
63
+ td.key {
64
+ background-color: #e0e0ff;
65
+ padding: 3px;
66
+ text-align: right;
67
+ border: 1px solid #c0c0c0;
68
+ white-space: nowrap;
69
+ font-weight: bold;
70
+ vertical-align: top;
71
+ }
72
+ .dcdata td.key {
73
+ background-color: #ffffe0;
74
+ }
75
+ body {
76
+ margin: 1em 2em 1em 2em;
77
+ }
78
+ h1, h2, h3 {
79
+ font-family: sans-serif;
80
+ clear: left;
81
+ }
82
+ h1 {
83
+ padding-bottom: 4px;
84
+ margin-bottom: 0px;
85
+ }
86
+ h2 {
87
+ margin-bottom: 0.5em;
88
+ }
89
+ h3 {
90
+ margin-bottom: 0.3em;
91
+ font-size: medium;
92
+ }
93
+ .link {
94
+ border: 1px outset #88f;
95
+ background-color: #c0c0ff;
96
+ padding: 1px 4px 1px 4px;
97
+ font-size: 80%;
98
+ text-decoration: none;
99
+ font-weight: bold;
100
+ font-family: sans-serif;
101
+ color: black;
102
+ }
103
+ .link:hover {
104
+ color: red;
105
+ }
106
+ .link:active {
107
+ color: red;
108
+ border: 1px inset #88f;
109
+ background-color: #a0a0df;
110
+ }
111
+ .oaiRecord, .oaiRecordTitle {
112
+ background-color: #f0f0ff;
113
+ border-style: solid;
114
+ border-color: #d0d0d0;
115
+ }
116
+ h2.oaiRecordTitle {
117
+ background-color: #e0e0ff;
118
+ font-size: medium;
119
+ font-weight: bold;
120
+ padding: 10px;
121
+ border-width: 2px 2px 0px 2px;
122
+ margin: 0px;
123
+ }
124
+ .oaiRecord {
125
+ margin-bottom: 3em;
126
+ border-width: 2px;
127
+ padding: 10px;
128
+ }
129
+
130
+ .results {
131
+ margin-bottom: 1.5em;
132
+ }
133
+ ul.quicklinks {
134
+ margin-top: 2px;
135
+ padding: 4px;
136
+ text-align: left;
137
+ border-bottom: 2px solid #ccc;
138
+ border-top: 2px solid #ccc;
139
+ clear: left;
140
+ }
141
+ ul.quicklinks li {
142
+ font-size: 80%;
143
+ display: inline;
144
+ list-stlye: none;
145
+ font-family: sans-serif;
146
+ }
147
+ p.intro {
148
+ font-size: 80%;
149
+ }
150
+ <xsl:call-template name='xmlstyle' />
151
+ </xsl:template>
152
+
153
+ <xsl:variable name='identifier' select="substring-before(concat(substring-after(/oai:OAI-PMH/oai:request,'identifier='),'&amp;'),'&amp;')" />
154
+
155
+ <xsl:template match="/">
156
+ <html>
157
+ <head>
158
+ <title>OAI 2.0 Request Results</title>
159
+ <style><xsl:call-template name="style"/></style>
160
+ </head>
161
+ <body>
162
+ <h1>OAI 2.0 Request Results</h1>
163
+ <xsl:call-template name="quicklinks"/>
164
+ <p class="intro">You are viewing an HTML version of the XML OAI response. To see the underlying XML use your web browsers view source option. More information about this XSLT is at the <a href="#moreinfo">bottom of the page</a>.</p>
165
+ <xsl:apply-templates select="/oai:OAI-PMH" />
166
+ <xsl:call-template name="quicklinks"/>
167
+ <h2><a name="moreinfo">About the XSLT</a></h2>
168
+ <p>An XSLT file has converted the <a href="http://www.openarchives.org">OAI-PMH 2.0</a> responses into XHTML which looks nice in a browser which supports XSLT such as Mozilla, Firebird and Internet Explorer. The XSLT file was created by <a href="http://www.ecs.soton.ac.uk/people/cjg">Christopher Gutteridge</a> at the University of Southampton as part of the <a href="http://software.eprints.org">GNU EPrints system</a>, and is freely redistributable under the <a href="http://www.gnu.org">GPL</a>.</p><p>If you want to use the XSL file on your own OAI interface you may but due to the way XSLT works you must install the XSL file on the same server as the OAI script, you can't just link to this copy.</p><p>For more information or to download the XSL file please see the <a href="http://software.eprints.org/xslt.php">OAI to XHTML XSLT homepage</a>.</p>
169
+
170
+ </body>
171
+ </html>
172
+ </xsl:template>
173
+
174
+ <xsl:template name="quicklinks">
175
+ <ul class="quicklinks">
176
+ <li><a href="?verb=Identify">Identify</a> | </li>
177
+ <li><a href="?verb=ListRecords&amp;metadataPrefix=oai_dc">ListRecords</a> | </li>
178
+ <li><a href="?verb=ListSets">ListSets</a> | </li>
179
+ <li><a href="?verb=ListMetadataFormats">ListMetadataFormats</a> | </li>
180
+ <li><a href="?verb=ListIdentifiers&amp;metadataPrefix=oai_dc">ListIdentifiers</a></li>
181
+ </ul>
182
+ </xsl:template>
183
+
184
+
185
+ <xsl:template match="/oai:OAI-PMH">
186
+ <table class="values">
187
+ <tr><td class="key">Datestamp of response</td>
188
+ <td class="value"><xsl:value-of select="oai:responseDate"/></td></tr>
189
+ <tr><td class="key">Request URL</td>
190
+ <td class="value"><xsl:value-of select="oai:request"/></td></tr>
191
+ </table>
192
+ <!-- verb: [<xsl:value-of select="oai:request/@verb" />]<br /> -->
193
+ <xsl:choose>
194
+ <xsl:when test="oai:error">
195
+ <h2>OAI Error(s)</h2>
196
+ <p>The request could not be completed due to the following error or errors.</p>
197
+ <div class="results">
198
+ <xsl:apply-templates select="oai:error"/>
199
+ </div>
200
+ </xsl:when>
201
+ <xsl:otherwise>
202
+ <p>Request was of type <xsl:value-of select="oai:request/@verb"/>.</p>
203
+ <div class="results">
204
+ <xsl:apply-templates select="oai:Identify" />
205
+ <xsl:apply-templates select="oai:GetRecord"/>
206
+ <xsl:apply-templates select="oai:ListRecords"/>
207
+ <xsl:apply-templates select="oai:ListSets"/>
208
+ <xsl:apply-templates select="oai:ListMetadataFormats"/>
209
+ <xsl:apply-templates select="oai:ListIdentifiers"/>
210
+ </div>
211
+ </xsl:otherwise>
212
+ </xsl:choose>
213
+ </xsl:template>
214
+
215
+
216
+ <!-- ERROR -->
217
+
218
+ <xsl:template match="/oai:OAI-PMH/oai:error">
219
+ <table class="values">
220
+ <tr><td class="key">Error Code</td>
221
+ <td class="value"><xsl:value-of select="@code"/></td></tr>
222
+ </table>
223
+ <p class="error"><xsl:value-of select="." /></p>
224
+ </xsl:template>
225
+
226
+ <!-- IDENTIFY -->
227
+
228
+ <xsl:template match="/oai:OAI-PMH/oai:Identify">
229
+ <table class="values">
230
+ <tr><td class="key">Repository Name</td>
231
+ <td class="value"><xsl:value-of select="oai:repositoryName"/></td></tr>
232
+ <tr><td class="key">Base URL</td>
233
+ <td class="value"><xsl:value-of select="oai:baseURL"/></td></tr>
234
+ <tr><td class="key">Protocol Version</td>
235
+ <td class="value"><xsl:value-of select="oai:protocolVersion"/></td></tr>
236
+ <tr><td class="key">Earliest Datestamp</td>
237
+ <td class="value"><xsl:value-of select="oai:earliestDatestamp"/></td></tr>
238
+ <tr><td class="key">Deleted Record Policy</td>
239
+ <td class="value"><xsl:value-of select="oai:deletedRecord"/></td></tr>
240
+ <tr><td class="key">Granularity</td>
241
+ <td class="value"><xsl:value-of select="oai:granularity"/></td></tr>
242
+ <xsl:apply-templates select="oai:adminEmail"/>
243
+ </table>
244
+ <xsl:apply-templates select="oai:description"/>
245
+ <!--no warning about unsupported descriptions -->
246
+ </xsl:template>
247
+
248
+ <xsl:template match="/oai:OAI-PMH/oai:Identify/oai:adminEmail">
249
+ <tr><td class="key">Admin Email</td>
250
+ <td class="value"><xsl:value-of select="."/></td></tr>
251
+ </xsl:template>
252
+
253
+ <!--
254
+ Identify / Unsupported Description
255
+ -->
256
+
257
+ <xsl:template match="oai:description/*" priority="-100">
258
+ <h2>Unsupported Description Type</h2>
259
+ <p>The XSL currently does not support this type of description.</p>
260
+ <div class="xmlSource">
261
+ <xsl:apply-templates select="." mode='xmlMarkup' />
262
+ </div>
263
+ </xsl:template>
264
+
265
+
266
+ <!--
267
+ Identify / OAI-Identifier
268
+ -->
269
+
270
+ <xsl:template match="id:oai-identifier" xmlns:id="http://www.openarchives.org/OAI/2.0/oai-identifier">
271
+ <h2>OAI-Identifier</h2>
272
+ <table class="values">
273
+ <tr><td class="key">Scheme</td>
274
+ <td class="value"><xsl:value-of select="id:scheme"/></td></tr>
275
+ <tr><td class="key">Repository Identifier</td>
276
+ <td class="value"><xsl:value-of select="id:repositoryIdentifier"/></td></tr>
277
+ <tr><td class="key">Delimiter</td>
278
+ <td class="value"><xsl:value-of select="id:delimiter"/></td></tr>
279
+ <tr><td class="key">Sample OAI Identifier</td>
280
+ <td class="value"><xsl:value-of select="id:sampleIdentifier"/></td></tr>
281
+ </table>
282
+ </xsl:template>
283
+
284
+
285
+ <!--
286
+ Identify / EPrints
287
+ -->
288
+
289
+ <xsl:template match="ep:eprints" xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints">
290
+ <h2>EPrints Description</h2>
291
+ <h3>Content</h3>
292
+ <xsl:apply-templates select="ep:content"/>
293
+ <xsl:if test="ep:submissionPolicy">
294
+ <h3>Submission Policy</h3>
295
+ <xsl:apply-templates select="ep:submissionPolicy"/>
296
+ </xsl:if>
297
+ <h3>Metadata Policy</h3>
298
+ <xsl:apply-templates select="ep:metadataPolicy"/>
299
+ <h3>Data Policy</h3>
300
+ <xsl:apply-templates select="ep:dataPolicy"/>
301
+ <xsl:if test="ep:content">
302
+ <h3>Content</h3>
303
+ <xsl:apply-templates select="ep:content"/>
304
+ </xsl:if>
305
+ <xsl:apply-templates select="ep:comment"/>
306
+ </xsl:template>
307
+
308
+ <xsl:template match="ep:content|ep:dataPolicy|ep:metadataPolicy|ep:submissionPolicy" xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints">
309
+ <xsl:if test="ep:text">
310
+ <p><xsl:value-of select="ep:text" /></p>
311
+ </xsl:if>
312
+ <xsl:if test="ep:URL">
313
+ <div><a href="{ep:URL}"><xsl:value-of select="ep:URL" /></a></div>
314
+ </xsl:if>
315
+ </xsl:template>
316
+
317
+ <xsl:template match="ep:comment" xmlns:ep="http://www.openarchives.org/OAI/1.1/eprints">
318
+ <h3>Comment</h3>
319
+ <div><xsl:value-of select="."/></div>
320
+ </xsl:template>
321
+
322
+
323
+ <!--
324
+ Identify / Friends
325
+ -->
326
+
327
+ <xsl:template match="fr:friends" xmlns:fr="http://www.openarchives.org/OAI/2.0/friends/">
328
+ <h2>Friends</h2>
329
+ <ul>
330
+ <xsl:apply-templates select="fr:baseURL"/>
331
+ </ul>
332
+ </xsl:template>
333
+
334
+ <xsl:template match="fr:baseURL" xmlns:fr="http://www.openarchives.org/OAI/2.0/friends/">
335
+ <li><xsl:value-of select="."/>
336
+ <xsl:text> </xsl:text>
337
+ <a class="link" href="{.}?verb=Identify">Identify</a></li>
338
+ </xsl:template>
339
+
340
+
341
+ <!--
342
+ Identify / Branding
343
+ -->
344
+
345
+ <xsl:template match="br:branding" xmlns:br="http://www.openarchives.org/OAI/2.0/branding/">
346
+ <h2>Branding</h2>
347
+ <xsl:apply-templates select="br:collectionIcon"/>
348
+ <xsl:apply-templates select="br:metadataRendering"/>
349
+ </xsl:template>
350
+
351
+ <xsl:template match="br:collectionIcon" xmlns:br="http://www.openarchives.org/OAI/2.0/branding/">
352
+ <h3>Icon</h3>
353
+ <xsl:choose>
354
+ <xsl:when test="link!=''">
355
+ <a href="{br:link}"><img src="{br:url}" alt="{br:title}" width="{br:width}" height="{br:height}" border="0" /></a>
356
+ </xsl:when>
357
+ <xsl:otherwise>
358
+ <img src="{br:url}" alt="{br:title}" width="{br:width}" height="{br:height}" border="0" />
359
+ </xsl:otherwise>
360
+ </xsl:choose>
361
+ </xsl:template>
362
+
363
+ <xsl:template match="br:metadataRendering" xmlns:br="http://www.openarchives.org/OAI/2.0/branding/">
364
+ <h3>Metadata Rendering Rule</h3>
365
+ <table class="values">
366
+ <tr><td class="key">URL</td>
367
+ <td class="value"><xsl:value-of select="."/></td></tr>
368
+ <tr><td class="key">Namespace</td>
369
+ <td class="value"><xsl:value-of select="@metadataNamespace"/></td></tr>
370
+ <tr><td class="key">Mime Type</td>
371
+ <td class="value"><xsl:value-of select="@mimetype"/></td></tr>
372
+ </table>
373
+ </xsl:template>
374
+
375
+
376
+
377
+ <!--
378
+ Identify / Gateway
379
+ -->
380
+
381
+ <xsl:template match="gw:gateway" xmlns:gw="http://www.openarchives.org/OAI/2.0/gateway/x">
382
+ <h2>Gateway Information</h2>
383
+ <table class="values">
384
+ <tr><td class="key">Source</td>
385
+ <td class="value"><xsl:value-of select="gw:source"/></td></tr>
386
+ <tr><td class="key">Description</td>
387
+ <td class="value"><xsl:value-of select="gw:gatewayDescription"/></td></tr>
388
+ <xsl:apply-templates select="gw:gatewayAdmin"/>
389
+ <xsl:if test="gw:gatewayURL">
390
+ <tr><td class="key">URL</td>
391
+ <td class="value"><xsl:value-of select="gw:gatewayURL"/></td></tr>
392
+ </xsl:if>
393
+ <xsl:if test="gw:gatewayNotes">
394
+ <tr><td class="key">Notes</td>
395
+ <td class="value"><xsl:value-of select="gw:gatewayNotes"/></td></tr>
396
+ </xsl:if>
397
+ </table>
398
+ </xsl:template>
399
+
400
+ <xsl:template match="gw:gatewayAdmin" xmlns:gw="http://www.openarchives.org/OAI/2.0/gateway/">
401
+ <tr><td class="key">Admin</td>
402
+ <td class="value"><xsl:value-of select="."/></td></tr>
403
+ </xsl:template>
404
+
405
+
406
+ <!-- GetRecord -->
407
+
408
+ <xsl:template match="oai:GetRecord">
409
+ <xsl:apply-templates select="oai:record" />
410
+ </xsl:template>
411
+
412
+ <!-- ListRecords -->
413
+
414
+ <xsl:template match="oai:ListRecords">
415
+ <xsl:apply-templates select="oai:record" />
416
+ <xsl:apply-templates select="oai:resumptionToken" />
417
+ </xsl:template>
418
+
419
+ <!-- ListIdentifiers -->
420
+
421
+ <xsl:template match="oai:ListIdentifiers">
422
+ <xsl:apply-templates select="oai:header" />
423
+ <xsl:apply-templates select="oai:resumptionToken" />
424
+ </xsl:template>
425
+
426
+ <!-- ListSets -->
427
+
428
+ <xsl:template match="oai:ListSets">
429
+ <xsl:apply-templates select="oai:set" />
430
+ <xsl:apply-templates select="oai:resumptionToken" />
431
+ </xsl:template>
432
+
433
+ <xsl:template match="oai:set">
434
+ <h2>Set</h2>
435
+ <table class="values">
436
+ <tr><td class="key">setName</td>
437
+ <td class="value"><xsl:value-of select="oai:setName"/></td></tr>
438
+ <xsl:apply-templates select="oai:setSpec" />
439
+ </table>
440
+ </xsl:template>
441
+
442
+ <!-- ListMetadataFormats -->
443
+
444
+ <xsl:template match="oai:ListMetadataFormats">
445
+ <xsl:choose>
446
+ <xsl:when test="$identifier">
447
+ <p>This is a list of metadata formats available for the record "<xsl:value-of select='$identifier' />". Use these links to view the metadata: <xsl:apply-templates select="oai:metadataFormat/oai:metadataPrefix" /></p>
448
+ </xsl:when>
449
+ <xsl:otherwise>
450
+ <p>This is a list of metadata formats available from this archive.</p>
451
+ </xsl:otherwise>
452
+ </xsl:choose>
453
+ <xsl:apply-templates select="oai:metadataFormat" />
454
+ </xsl:template>
455
+
456
+ <xsl:template match="oai:metadataFormat">
457
+ <h2>Metadata Format</h2>
458
+ <table class="values">
459
+ <tr><td class="key">metadataPrefix</td>
460
+ <td class="value"><xsl:value-of select="oai:metadataPrefix"/></td></tr>
461
+ <tr><td class="key">metadataNamespace</td>
462
+ <td class="value"><xsl:value-of select="oai:metadataNamespace"/></td></tr>
463
+ <tr><td class="key">schema</td>
464
+ <td class="value"><a href="{oai:schema}"><xsl:value-of select="oai:schema"/></a></td></tr>
465
+ </table>
466
+ </xsl:template>
467
+
468
+ <xsl:template match="oai:metadataPrefix">
469
+ <xsl:text> </xsl:text><a class="link" href="?verb=GetRecord&amp;metadataPrefix={.}&amp;identifier={$identifier}"><xsl:value-of select='.' /></a>
470
+ </xsl:template>
471
+
472
+ <!-- record object -->
473
+
474
+ <xsl:template match="oai:record">
475
+ <h2 class="oaiRecordTitle">OAI Record: <xsl:value-of select="oai:header/oai:identifier"/></h2>
476
+ <div class="oaiRecord">
477
+ <xsl:apply-templates select="oai:header" />
478
+ <xsl:apply-templates select="oai:metadata" />
479
+ <xsl:apply-templates select="oai:about" />
480
+ </div>
481
+ </xsl:template>
482
+
483
+ <xsl:template match="oai:header">
484
+ <h3>OAI Record Header</h3>
485
+ <table class="values">
486
+ <tr><td class="key">OAI Identifier</td>
487
+ <td class="value">
488
+ <xsl:value-of select="oai:identifier"/>
489
+ <xsl:text> </xsl:text><a class="link" href="?verb=GetRecord&amp;metadataPrefix=oai_dc&amp;identifier={oai:identifier}">oai_dc</a>
490
+ <xsl:text> </xsl:text><a class="link" href="?verb=ListMetadataFormats&amp;identifier={oai:identifier}">formats</a>
491
+ </td></tr>
492
+ <tr><td class="key">Datestamp</td>
493
+ <td class="value"><xsl:value-of select="oai:datestamp"/></td></tr>
494
+ <xsl:apply-templates select="oai:setSpec" />
495
+ </table>
496
+ <xsl:if test="@status='deleted'">
497
+ <p>This record has been deleted.</p>
498
+ </xsl:if>
499
+ </xsl:template>
500
+
501
+
502
+ <xsl:template match="oai:about">
503
+ <p>"about" part of record container not supported by the XSL</p>
504
+ </xsl:template>
505
+
506
+ <xsl:template match="oai:metadata">
507
+ &#160;
508
+ <div class="metadata">
509
+ <xsl:apply-templates select="*" />
510
+ </div>
511
+ </xsl:template>
512
+
513
+
514
+
515
+
516
+ <!-- oai setSpec object -->
517
+
518
+ <xsl:template match="oai:setSpec">
519
+ <tr><td class="key">setSpec</td>
520
+ <td class="value"><xsl:value-of select="."/>
521
+ <xsl:text> </xsl:text><a class="link" href="?verb=ListIdentifiers&amp;metadataPrefix=oai_dc&amp;set={.}">Identifiers</a>
522
+ <xsl:text> </xsl:text><a class="link" href="?verb=ListRecords&amp;metadataPrefix=oai_dc&amp;set={.}">Records</a>
523
+ </td></tr>
524
+ </xsl:template>
525
+
526
+
527
+
528
+ <!-- oai resumptionToken -->
529
+
530
+ <xsl:template match="oai:resumptionToken">
531
+ <p>There are more results.</p>
532
+ <table class="values">
533
+ <tr><td class="key">resumptionToken:</td>
534
+ <td class="value"><xsl:value-of select="."/>
535
+ <xsl:text> </xsl:text>
536
+ <a class="link" href="?verb={/oai:OAI-PMH/oai:request/@verb}&amp;resumptionToken={.}">Resume</a></td></tr>
537
+ </table>
538
+ </xsl:template>
539
+
540
+ <!-- unknown metadata format -->
541
+
542
+ <xsl:template match="oai:metadata/*" priority='-100'>
543
+ <h3>Unknown Metadata Format</h3>
544
+ <div class="xmlSource">
545
+ <xsl:apply-templates select="." mode='xmlMarkup' />
546
+ </div>
547
+ </xsl:template>
548
+
549
+ <!-- oai_dc record -->
550
+
551
+ <xsl:template match="oai_dc:dc" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" >
552
+ <div class="dcdata">
553
+ <h3>Dublin Core Metadata (oai_dc)</h3>
554
+ <table class="dcdata">
555
+ <xsl:apply-templates select="*" />
556
+ </table>
557
+ </div>
558
+ </xsl:template>
559
+
560
+ <xsl:template match="dc:title" xmlns:dc="http://purl.org/dc/elements/1.1/">
561
+ <tr><td class="key">Title</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
562
+
563
+ <xsl:template match="dc:creator" xmlns:dc="http://purl.org/dc/elements/1.1/">
564
+ <tr><td class="key">Author or Creator</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
565
+
566
+ <xsl:template match="dc:subject" xmlns:dc="http://purl.org/dc/elements/1.1/">
567
+ <tr><td class="key">Subject and Keywords</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
568
+
569
+ <xsl:template match="dc:description" xmlns:dc="http://purl.org/dc/elements/1.1/">
570
+ <tr><td class="key">Description</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
571
+
572
+ <xsl:template match="dc:publisher" xmlns:dc="http://purl.org/dc/elements/1.1/">
573
+ <tr><td class="key">Publisher</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
574
+
575
+ <xsl:template match="dc:contributor" xmlns:dc="http://purl.org/dc/elements/1.1/">
576
+ <tr><td class="key">Other Contributor</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
577
+
578
+ <xsl:template match="dc:date" xmlns:dc="http://purl.org/dc/elements/1.1/">
579
+ <tr><td class="key">Date</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
580
+
581
+ <xsl:template match="dc:type" xmlns:dc="http://purl.org/dc/elements/1.1/">
582
+ <tr><td class="key">Resource Type</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
583
+
584
+ <xsl:template match="dc:format" xmlns:dc="http://purl.org/dc/elements/1.1/">
585
+ <tr><td class="key">Format</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
586
+
587
+ <xsl:template match="dc:identifier" xmlns:dc="http://purl.org/dc/elements/1.1/">
588
+ <tr><td class="key">Resource Identifier</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
589
+
590
+ <xsl:template match="dc:source" xmlns:dc="http://purl.org/dc/elements/1.1/">
591
+ <tr><td class="key">Source</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
592
+
593
+ <xsl:template match="dc:language" xmlns:dc="http://purl.org/dc/elements/1.1/">
594
+ <tr><td class="key">Language</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
595
+
596
+ <xsl:template match="dc:relation" xmlns:dc="http://purl.org/dc/elements/1.1/">
597
+ <tr><td class="key">Relation</td><td class="value">
598
+ <xsl:choose>
599
+ <xsl:when test='starts-with(.,"http" )'>
600
+ <xsl:choose>
601
+ <xsl:when test='string-length(.) &gt; 50'>
602
+ <a class="link" href="{.}">URL</a>
603
+ <i> URL not shown as it is very long.</i>
604
+ </xsl:when>
605
+ <xsl:otherwise>
606
+ <a href="{.}"><xsl:value-of select="."/></a>
607
+ </xsl:otherwise>
608
+ </xsl:choose>
609
+ </xsl:when>
610
+ <xsl:otherwise>
611
+ <xsl:value-of select="."/>
612
+ </xsl:otherwise>
613
+ </xsl:choose>
614
+ </td></tr></xsl:template>
615
+
616
+ <xsl:template match="dc:coverage" xmlns:dc="http://purl.org/dc/elements/1.1/">
617
+ <tr><td class="key">Coverage</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
618
+
619
+ <xsl:template match="dc:rights" xmlns:dc="http://purl.org/dc/elements/1.1/">
620
+ <tr><td class="key">Rights Management</td><td class="value"><xsl:value-of select="."/></td></tr></xsl:template>
621
+
622
+ <!-- XML Pretty Maker -->
623
+
624
+ <xsl:template match="node()" mode='xmlMarkup'>
625
+ <div class="xmlBlock">
626
+ &lt;<span class="xmlTagName"><xsl:value-of select='name(.)' /></span><xsl:apply-templates select="@*" mode='xmlMarkup'/>&gt;<xsl:apply-templates select="node()" mode='xmlMarkup' />&lt;/<span class="xmlTagName"><xsl:value-of select='name(.)' /></span>&gt;
627
+ </div>
628
+ </xsl:template>
629
+
630
+ <xsl:template match="text()" mode='xmlMarkup'><span class="xmlText"><xsl:value-of select='.' /></span></xsl:template>
631
+
632
+ <xsl:template match="@*" mode='xmlMarkup'>
633
+ <xsl:text> </xsl:text><span class="xmlAttrName"><xsl:value-of select='name()' /></span>="<span class="xmlAttrValue"><xsl:value-of select='.' /></span>"
634
+ </xsl:template>
635
+
636
+ <xsl:template name="xmlstyle">
637
+ .xmlSource {
638
+ font-size: 70%;
639
+ border: solid #c0c0a0 1px;
640
+ background-color: #ffffe0;
641
+ padding: 2em 2em 2em 0em;
642
+ }
643
+ .xmlBlock {
644
+ padding-left: 2em;
645
+ }
646
+ .xmlTagName {
647
+ color: #800000;
648
+ font-weight: bold;
649
+ }
650
+ .xmlAttrName {
651
+ font-weight: bold;
652
+ }
653
+ .xmlAttrValue {
654
+ color: #0000c0;
655
+ }
656
+ </xsl:template>
657
+
658
+ </xsl:stylesheet>
659
+
@@ -12,7 +12,7 @@ module BlacklightOaiProvider::ControllerExtension
12
12
  # first found min/max from result set.
13
13
  def oai
14
14
  options = params.delete_if { |k,v| %w{controller action}.include?(k) }
15
- render :text => oai_provider.process_request(options), :content_type => 'text/xml'
15
+ render :text => oai_provider.process_request(options).gsub('<?xml version="1.0" encoding="UTF-8"?>', "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<?xml-stylesheet type=\"text/xsl\" href=\"#{ asset_path('oai2.xsl')}\" ?>"), :content_type => 'text/xml'
16
16
  end
17
17
 
18
18
  # Uses Blacklight.config, needs to be modified when
@@ -20,7 +20,7 @@ module BlacklightOaiProvider
20
20
  def self.omit_inject ; @omit_inject ; end
21
21
 
22
22
  def self.inject!
23
- unless BlacklightRangeLimit.omit_inject[:routes]
23
+ unless BlacklightOaiProvider.omit_inject[:routes]
24
24
  Blacklight::Routes.send(:include, BlacklightOaiProvider::RouteSets)
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,80 +1,61 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: blacklight_oai_provider
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Chris Beer
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-26 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2152523360 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 3
32
- - 0
33
- version: "3.0"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: blacklight
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2152523360
25
+ - !ruby/object:Gem::Dependency
26
+ name: blacklight
27
+ requirement: &2152522400 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
48
33
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: oai
52
34
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2152522400
36
+ - !ruby/object:Gem::Dependency
37
+ name: oai
38
+ requirement: &2152521520 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
62
44
  type: :runtime
63
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *2152521520
64
47
  description:
65
- email:
48
+ email:
66
49
  - chris_beer@wgbh.org
67
50
  executables: []
68
-
69
51
  extensions: []
70
-
71
52
  extra_rdoc_files: []
72
-
73
- files:
53
+ files:
74
54
  - MIT-LICENSE
75
55
  - README.rdoc
76
56
  - Rakefile
77
57
  - VERSION
58
+ - app/assets/xsl/oai2.xsl
78
59
  - blacklight_oai_provider.gemspec
79
60
  - config/routes.rb
80
61
  - lib/blacklight_oai_provider.rb
@@ -87,39 +68,28 @@ files:
87
68
  - lib/blacklight_oai_provider/solr_document_wrapper.rb
88
69
  - lib/blacklight_oai_provider/version.rb
89
70
  - lib/generators/blacklight_oai_provider/blacklight_oai_provider_generator.rb
90
- has_rdoc: true
91
71
  homepage: http://projectblacklight.org/
92
72
  licenses: []
93
-
94
73
  post_install_message:
95
74
  rdoc_options: []
96
-
97
- require_paths:
75
+ require_paths:
98
76
  - lib
99
- required_ruby_version: !ruby/object:Gem::Requirement
77
+ required_ruby_version: !ruby/object:Gem::Requirement
100
78
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
108
- required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
84
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
117
89
  requirements: []
118
-
119
90
  rubyforge_project: blacklight
120
- rubygems_version: 1.6.2
91
+ rubygems_version: 1.8.10
121
92
  signing_key:
122
93
  specification_version: 3
123
94
  summary: Blacklight Oai Provider plugin
124
95
  test_files: []
125
-