blacklight-citeproc 0.0.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.env +3 -0
  3. data/.github/workflows/test.yml +25 -0
  4. data/.internal_test_app/solr/conf/_rest_managed.json +3 -0
  5. data/.internal_test_app/solr/conf/admin-extra.html +31 -0
  6. data/.internal_test_app/solr/conf/currency.xml +67 -0
  7. data/.internal_test_app/solr/conf/email_url_types.txt +2 -0
  8. data/.internal_test_app/solr/conf/lang/contractions_ca.txt +8 -0
  9. data/.internal_test_app/solr/conf/lang/contractions_fr.txt +15 -0
  10. data/.internal_test_app/solr/conf/lang/contractions_ga.txt +5 -0
  11. data/.internal_test_app/solr/conf/lang/contractions_it.txt +23 -0
  12. data/.internal_test_app/solr/conf/lang/hyphenations_ga.txt +5 -0
  13. data/.internal_test_app/solr/conf/lang/stemdict_nl.txt +6 -0
  14. data/.internal_test_app/solr/conf/lang/stoptags_ja.txt +420 -0
  15. data/.internal_test_app/solr/conf/lang/stopwords_ar.txt +125 -0
  16. data/.internal_test_app/solr/conf/lang/stopwords_bg.txt +193 -0
  17. data/.internal_test_app/solr/conf/lang/stopwords_ca.txt +220 -0
  18. data/.internal_test_app/solr/conf/lang/stopwords_cz.txt +172 -0
  19. data/.internal_test_app/solr/conf/lang/stopwords_da.txt +110 -0
  20. data/.internal_test_app/solr/conf/lang/stopwords_de.txt +294 -0
  21. data/.internal_test_app/solr/conf/lang/stopwords_el.txt +78 -0
  22. data/.internal_test_app/solr/conf/lang/stopwords_en.txt +54 -0
  23. data/.internal_test_app/solr/conf/lang/stopwords_es.txt +356 -0
  24. data/.internal_test_app/solr/conf/lang/stopwords_eu.txt +99 -0
  25. data/.internal_test_app/solr/conf/lang/stopwords_fa.txt +313 -0
  26. data/.internal_test_app/solr/conf/lang/stopwords_fi.txt +97 -0
  27. data/.internal_test_app/solr/conf/lang/stopwords_fr.txt +186 -0
  28. data/.internal_test_app/solr/conf/lang/stopwords_ga.txt +110 -0
  29. data/.internal_test_app/solr/conf/lang/stopwords_gl.txt +161 -0
  30. data/.internal_test_app/solr/conf/lang/stopwords_hi.txt +235 -0
  31. data/.internal_test_app/solr/conf/lang/stopwords_hu.txt +211 -0
  32. data/.internal_test_app/solr/conf/lang/stopwords_hy.txt +46 -0
  33. data/.internal_test_app/solr/conf/lang/stopwords_id.txt +359 -0
  34. data/.internal_test_app/solr/conf/lang/stopwords_it.txt +303 -0
  35. data/.internal_test_app/solr/conf/lang/stopwords_ja.txt +127 -0
  36. data/.internal_test_app/solr/conf/lang/stopwords_lv.txt +172 -0
  37. data/.internal_test_app/solr/conf/lang/stopwords_nl.txt +119 -0
  38. data/.internal_test_app/solr/conf/lang/stopwords_no.txt +194 -0
  39. data/.internal_test_app/solr/conf/lang/stopwords_pt.txt +253 -0
  40. data/.internal_test_app/solr/conf/lang/stopwords_ro.txt +233 -0
  41. data/.internal_test_app/solr/conf/lang/stopwords_ru.txt +243 -0
  42. data/.internal_test_app/solr/conf/lang/stopwords_sv.txt +133 -0
  43. data/.internal_test_app/solr/conf/lang/stopwords_th.txt +119 -0
  44. data/.internal_test_app/solr/conf/lang/stopwords_tr.txt +212 -0
  45. data/.internal_test_app/solr/conf/lang/userdict_ja.txt +29 -0
  46. data/.internal_test_app/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  47. data/.internal_test_app/solr/conf/protwords.txt +21 -0
  48. data/.internal_test_app/solr/conf/schema.xml +408 -0
  49. data/.internal_test_app/solr/conf/scripts.conf +24 -0
  50. data/.internal_test_app/solr/conf/solrconfig.xml +1287 -0
  51. data/.internal_test_app/solr/conf/spellings.txt +2 -0
  52. data/.internal_test_app/solr/conf/stopwords.txt +14 -0
  53. data/.internal_test_app/solr/conf/stopwords_en.txt +58 -0
  54. data/.internal_test_app/solr/conf/synonyms.txt +13 -0
  55. data/.internal_test_app/solr/conf/update-script.js +115 -0
  56. data/.internal_test_app/solr/conf/velocity/browse.vm +32 -0
  57. data/.internal_test_app/solr/conf/velocity/dropit.js +0 -0
  58. data/.internal_test_app/solr/conf/velocity/facet_doc_type.vm +2 -0
  59. data/.internal_test_app/solr/conf/velocity/facet_text_shingles.vm +12 -0
  60. data/.internal_test_app/solr/conf/velocity/facets.vm +24 -0
  61. data/.internal_test_app/solr/conf/velocity/footer.vm +29 -0
  62. data/.internal_test_app/solr/conf/velocity/head.vm +290 -0
  63. data/.internal_test_app/solr/conf/velocity/hit.vm +77 -0
  64. data/.internal_test_app/solr/conf/velocity/img/english_640.png +0 -0
  65. data/.internal_test_app/solr/conf/velocity/img/france_640.png +0 -0
  66. data/.internal_test_app/solr/conf/velocity/img/germany_640.png +0 -0
  67. data/.internal_test_app/solr/conf/velocity/img/globe_256.png +0 -0
  68. data/.internal_test_app/solr/conf/velocity/jquery.tx3-tag-cloud.js +0 -0
  69. data/.internal_test_app/solr/conf/velocity/js/dropit.js +97 -0
  70. data/.internal_test_app/solr/conf/velocity/js/jquery.autocomplete.js +763 -0
  71. data/.internal_test_app/solr/conf/velocity/js/jquery.tx3-tag-cloud.js +70 -0
  72. data/.internal_test_app/solr/conf/velocity/layout.vm +42 -0
  73. data/.internal_test_app/solr/conf/velocity/macros.vm +16 -0
  74. data/.internal_test_app/solr/conf/velocity/mime_type_lists.vm +68 -0
  75. data/.internal_test_app/solr/conf/velocity/results.vm +20 -0
  76. data/.internal_test_app/solr/conf/velocity/results_list.vm +21 -0
  77. data/.internal_test_app/solr/conf/xslt/example.xsl +132 -0
  78. data/.internal_test_app/solr/conf/xslt/example_atom.xsl +67 -0
  79. data/.internal_test_app/solr/conf/xslt/example_rss.xsl +66 -0
  80. data/.internal_test_app/solr/conf/xslt/luke.xsl +337 -0
  81. data/.rubocop.yml +4 -0
  82. data/.rubocop_todo.yml +40 -0
  83. data/Dockerfile +43 -0
  84. data/Gemfile +5 -0
  85. data/LICENSE.md +21 -0
  86. data/README.md +3 -0
  87. data/Rakefile +8 -0
  88. data/app/controllers/blacklight/citeproc/citation_controller.rb +45 -40
  89. data/app/models/concerns/blacklight/document/bibtex.rb +37 -35
  90. data/bin/entrypoint.sh +8 -0
  91. data/blacklight-citeproc.gemspec +19 -19
  92. data/config/routes.rb +2 -0
  93. data/docker-compose.yml +33 -0
  94. data/lib/blacklight/citeproc/engine.rb +2 -0
  95. data/lib/blacklight/citeproc/version.rb +3 -1
  96. data/lib/blacklight/citeproc.rb +2 -0
  97. data/lib/generators/blacklight/citeproc/install_generator.rb +20 -15
  98. metadata +119 -40
@@ -0,0 +1,70 @@
1
+ /*
2
+ * ----------------------------------------------------------------------------
3
+ * "THE BEER-WARE LICENSE" (Revision 42):
4
+ * Tuxes3 wrote this file. As long as you retain this notice you
5
+ * can do whatever you want with this stuff. If we meet some day, and you think
6
+ * this stuff is worth it, you can buy me a beer in return Tuxes3
7
+ * ----------------------------------------------------------------------------
8
+ */
9
+ (function($)
10
+ {
11
+ var settings;
12
+ $.fn.tx3TagCloud = function(options)
13
+ {
14
+
15
+ //
16
+ // DEFAULT SETTINGS
17
+ //
18
+ settings = $.extend({
19
+ multiplier : 1
20
+ }, options);
21
+ main(this);
22
+
23
+ }
24
+
25
+ function main(element)
26
+ {
27
+ // adding style attr
28
+ element.addClass("tx3-tag-cloud");
29
+ addListElementFontSize(element);
30
+ }
31
+
32
+ /**
33
+ * calculates the font size on each li element
34
+ * according to their data-weight attribut
35
+ */
36
+ function addListElementFontSize(element)
37
+ {
38
+ var hDataWeight = -9007199254740992;
39
+ var lDataWeight = 9007199254740992;
40
+ $.each(element.find("li"), function(){
41
+ cDataWeight = getDataWeight(this);
42
+ if (cDataWeight == undefined)
43
+ {
44
+ logWarning("No \"data-weight\" attribut defined on <li> element");
45
+ }
46
+ else
47
+ {
48
+ hDataWeight = cDataWeight > hDataWeight ? cDataWeight : hDataWeight;
49
+ lDataWeight = cDataWeight < lDataWeight ? cDataWeight : lDataWeight;
50
+ }
51
+ });
52
+ $.each(element.find("li"), function(){
53
+ var dataWeight = getDataWeight(this);
54
+ var percent = Math.abs((dataWeight - lDataWeight)/(lDataWeight - hDataWeight));
55
+ $(this).css('font-size', (1 + (percent * settings['multiplier'])) + "em");
56
+ });
57
+
58
+ }
59
+
60
+ function getDataWeight(element)
61
+ {
62
+ return parseInt($(element).attr("data-weight"));
63
+ }
64
+
65
+ function logWarning(message)
66
+ {
67
+ console.log("[WARNING] " + Date.now() + " : " + message);
68
+ }
69
+
70
+ }(jQuery));
@@ -0,0 +1,42 @@
1
+ <html>
2
+ <head>
3
+ #parse("head.vm")
4
+ </head>
5
+ <body>
6
+ <div id="header">
7
+ <a href="#url_for_home"><img src="#{url_root}/img/solr.svg" id="logo" title="Solr"/></a> $resource.powered_file_search
8
+ </div>
9
+
10
+ <div id="header2" onclick="javascript:locale_select()">
11
+ <ul class="menu">
12
+
13
+ <li>
14
+ <a href="#"><img src="#{url_for_solr}/admin/file?file=/velocity/img/globe_256.png&contentType=image/png" id="locale_pic" title="locale_select" width="30px" height="27px"/></a>
15
+ <ul>
16
+ <li><a href="#url_for_locale('fr_FR')" #if("#current_locale"=="fr_FR")class="hidden"#end>
17
+ <img src="#{url_for_solr}/admin/file?file=/velocity/img/france_640.png&contentType=image/png" id="french_flag" width="40px" height="40px"/>Fran&ccedil;ais</a></li>
18
+ <li><a href="#url_for_locale('de_DE')" #if("#current_locale"=="de_DE")class="hidden"#end>
19
+ <img src="#{url_for_solr}/admin/file?file=/velocity/img/germany_640.png&contentType=image/png" id="german_flag" width="40px" height="40px"/>Deutsch</a></li>
20
+ <li><a href="#url_for_locale('')" #if("#current_locale"=="")class="hidden"#end>
21
+ <img src="#{url_for_solr}/admin/file?file=/velocity/img/english_640.png&contentType=image/png" id="english_flag" width="40px" height="40px"/>English</a></li>
22
+ </ul>
23
+ </li>
24
+ </ul>
25
+ </div>
26
+
27
+ #if($response.response.error.code)
28
+ <div class="error">
29
+ <h1>ERROR $response.response.error.code</h1>
30
+ $response.response.error.msg
31
+ </div>
32
+ #else
33
+ <div id="content">
34
+ $content
35
+ </div>
36
+ #end
37
+
38
+ <div id="footer">
39
+ #parse("footer.vm")
40
+ </div>
41
+ </body>
42
+ </html>
@@ -0,0 +1,16 @@
1
+ #macro(lensFilterSortOnly)?#if($response.responseHeader.params.getAll("fq").size() > 0)&#fqs($response.responseHeader.params.getAll("fq"))#end#sort($request.params.getParams('sort'))#end
2
+ #macro(lensNoQ)#lensFilterSortOnly&type=#current_type#if("#current_locale"!="")&locale=#current_locale#end#end
3
+ #macro(lensNoType)#lensFilterSortOnly#q#if("#current_locale"!="")&locale=#current_locale#end#end
4
+ #macro(lensNoLocale)#lensFilterSortOnly#q&type=#current_type#end
5
+
6
+ ## lens modified for example/files - to use fq from responseHeader rather than request, and #debug removed too as it is built into browse params now, also added type to lens
7
+ #macro(lens)#lensNoQ#q#end
8
+
9
+ ## Macros defined custom for the "files" example
10
+ #macro(url_for_type $type)#url_for_home#lensNoType&type=$type#end
11
+ #macro(current_type)#if($response.responseHeader.params.type)${response.responseHeader.params.type}#{else}all#end#end
12
+ #macro(url_for_locale $locale)#url_for_home#lensNoLocale#if($locale!="")&locale=$locale#end&start=$page.start#end
13
+ #macro(current_locale)$!{response.responseHeader.params.locale}#end
14
+
15
+ ## Usage: #label(resource_key[, default_value]) - resource_key is used as label if no default value specified and no resource exists
16
+ #macro(label $key $default)#if($resource.get($key).exists)${resource.get($key)}#else#if($default)$default#else${key}#end#end#end
@@ -0,0 +1,68 @@
1
+ #**
2
+ * Define some Mime-Types, short and long form
3
+ *#
4
+
5
+ ## MimeType to extension map for detecting file type
6
+ ## and showing proper icon
7
+ ## List of types match the icons in /solr/img/filetypes
8
+
9
+ ## Short MimeType Names
10
+ ## Was called $supportedtypes
11
+ #set($supportedMimeTypes = "7z;ai;aiff;asc;audio;bin;bz2;c;cfc;cfm;chm;class;conf;cpp;cs;css;csv;deb;divx;doc;dot;eml;enc;file;gif;gz;hlp;htm;html;image;iso;jar;java;jpeg;jpg;js;lua;m;mm;mov;mp3;mpg;odc;odf;odg;odi;odp;ods;odt;ogg;pdf;pgp;php;pl;png;ppt;ps;py;ram;rar;rb;rm;rpm;rtf;sig;sql;swf;sxc;sxd;sxi;sxw;tar;tex;tgz;txt;vcf;video;vsd;wav;wma;wmv;xls;xml;xpi;xvid;zip")
12
+
13
+ ## Long Form: map MimeType headers to our Short names
14
+ ## Was called $extMap
15
+ #set( $mimeExtensionsMap = {
16
+ "application/x-7z-compressed": "7z",
17
+ "application/postscript": "ai",
18
+ "application/pgp-signature": "asc",
19
+ "application/octet-stream": "bin",
20
+ "application/x-bzip2": "bz2",
21
+ "text/x-c": "c",
22
+ "application/vnd.ms-htmlhelp": "chm",
23
+ "application/java-vm": "class",
24
+ "text/css": "css",
25
+ "text/csv": "csv",
26
+ "application/x-debian-package": "deb",
27
+ "application/msword": "doc",
28
+ "message/rfc822": "eml",
29
+ "image/gif": "gif",
30
+ "application/winhlp": "hlp",
31
+ "text/html": "html",
32
+ "application/java-archive": "jar",
33
+ "text/x-java-source": "java",
34
+ "image/jpeg": "jpeg",
35
+ "application/javascript": "js",
36
+ "application/vnd.oasis.opendocument.chart": "odc",
37
+ "application/vnd.oasis.opendocument.formula": "odf",
38
+ "application/vnd.oasis.opendocument.graphics": "odg",
39
+ "application/vnd.oasis.opendocument.image": "odi",
40
+ "application/vnd.oasis.opendocument.presentation": "odp",
41
+ "application/vnd.oasis.opendocument.spreadsheet": "ods",
42
+ "application/vnd.oasis.opendocument.text": "odt",
43
+ "application/pdf": "pdf",
44
+ "application/pgp-encrypted": "pgp",
45
+ "image/png": "png",
46
+ "application/vnd.ms-powerpoint": "ppt",
47
+ "audio/x-pn-realaudio": "ram",
48
+ "application/x-rar-compressed": "rar",
49
+ "application/vnd.rn-realmedia": "rm",
50
+ "application/rtf": "rtf",
51
+ "application/x-shockwave-flash": "swf",
52
+ "application/vnd.sun.xml.calc": "sxc",
53
+ "application/vnd.sun.xml.draw": "sxd",
54
+ "application/vnd.sun.xml.impress": "sxi",
55
+ "application/vnd.sun.xml.writer": "sxw",
56
+ "application/x-tar": "tar",
57
+ "application/x-tex": "tex",
58
+ "text/plain": "txt",
59
+ "text/x-vcard": "vcf",
60
+ "application/vnd.visio": "vsd",
61
+ "audio/x-wav": "wav",
62
+ "audio/x-ms-wma": "wma",
63
+ "video/x-ms-wmv": "wmv",
64
+ "application/vnd.ms-excel": "xls",
65
+ "application/xml": "xml",
66
+ "application/x-xpinstall": "xpi",
67
+ "application/zip": "zip"
68
+ })
@@ -0,0 +1,20 @@
1
+ <div id="facets">
2
+ #parse("facets.vm")
3
+ </div>
4
+
5
+
6
+ <div id="results_list">
7
+ <div class="pagination">
8
+ <span class="results-found">$page.results_found</span> $resource.results_found_in.insert(${response.responseHeader.QTime})
9
+ $resource.page_of.insert($page.current_page_number,$page.page_count)
10
+ </div>
11
+
12
+ #parse("results_list.vm")
13
+
14
+ <div class="pagination">
15
+ #link_to_previous_page
16
+ <span class="results-found">$page.results_found</span> $resource.results_found.
17
+ $resource.page_of.insert($page.current_page_number,$page.page_count)
18
+ #link_to_next_page
19
+ </div>
20
+ </div>
@@ -0,0 +1,21 @@
1
+ <ul id="tabs">
2
+ <li><a href="#url_for_type('all')" #if("#current_type"=="all")class="selected"#end>$resource.type.all ($response.response.facet_counts.facet_queries.all_types)</a></li>
3
+ #foreach($type in $response.response.facet_counts.facet_fields.doc_type)
4
+ #if($type.key)
5
+ <li><a href="#url_for_type($type.key)" #if($type.value=="0")class="no_results"#end #if("#current_type"==$type.key)class="selected"#end> #label("type.${type.key}.label", $type.key) ($type.value)</a></li>
6
+ #else
7
+ #if($type.value > 0)
8
+ <li><a href="#url_for_type('unknown')" #if("#current_type"=="unknown")class="selected"#end>$resource.type.unknown ($type.value)</a></li>
9
+ #end
10
+ #end
11
+ #end
12
+ </ul>
13
+
14
+
15
+ <div id="results">
16
+ #foreach($doc in $response.results)
17
+ #parse("hit.vm")
18
+ #end
19
+ </div>
20
+
21
+
@@ -0,0 +1,132 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <!--
4
+ * Licensed to the Apache Software Foundation (ASF) under one or more
5
+ * contributor license agreements. See the NOTICE file distributed with
6
+ * this work for additional information regarding copyright ownership.
7
+ * The ASF licenses this file to You under the Apache License, Version 2.0
8
+ * (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ -->
19
+
20
+ <!--
21
+ Simple transform of Solr query results to HTML
22
+ -->
23
+ <xsl:stylesheet version='1.0'
24
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
25
+ >
26
+
27
+ <xsl:output media-type="text/html; charset=UTF-8" encoding="UTF-8"/>
28
+
29
+ <xsl:variable name="title" select="concat('Solr search results (',response/result/@numFound,' documents)')"/>
30
+
31
+ <xsl:template match='/'>
32
+ <html>
33
+ <head>
34
+ <title><xsl:value-of select="$title"/></title>
35
+ <xsl:call-template name="css"/>
36
+ </head>
37
+ <body>
38
+ <h1><xsl:value-of select="$title"/></h1>
39
+ <div class="note">
40
+ This has been formatted by the sample "example.xsl" transform -
41
+ use your own XSLT to get a nicer page
42
+ </div>
43
+ <xsl:apply-templates select="response/result/doc"/>
44
+ </body>
45
+ </html>
46
+ </xsl:template>
47
+
48
+ <xsl:template match="doc">
49
+ <xsl:variable name="pos" select="position()"/>
50
+ <div class="doc">
51
+ <table width="100%">
52
+ <xsl:apply-templates>
53
+ <xsl:with-param name="pos"><xsl:value-of select="$pos"/></xsl:with-param>
54
+ </xsl:apply-templates>
55
+ </table>
56
+ </div>
57
+ </xsl:template>
58
+
59
+ <xsl:template match="doc/*[@name='score']" priority="100">
60
+ <xsl:param name="pos"></xsl:param>
61
+ <tr>
62
+ <td class="name">
63
+ <xsl:value-of select="@name"/>
64
+ </td>
65
+ <td class="value">
66
+ <xsl:value-of select="."/>
67
+
68
+ <xsl:if test="boolean(//lst[@name='explain'])">
69
+ <xsl:element name="a">
70
+ <!-- can't allow whitespace here -->
71
+ <xsl:attribute name="href">javascript:toggle("<xsl:value-of select="concat('exp-',$pos)" />");</xsl:attribute>?</xsl:element>
72
+ <br/>
73
+ <xsl:element name="div">
74
+ <xsl:attribute name="class">exp</xsl:attribute>
75
+ <xsl:attribute name="id">
76
+ <xsl:value-of select="concat('exp-',$pos)" />
77
+ </xsl:attribute>
78
+ <xsl:value-of select="//lst[@name='explain']/str[position()=$pos]"/>
79
+ </xsl:element>
80
+ </xsl:if>
81
+ </td>
82
+ </tr>
83
+ </xsl:template>
84
+
85
+ <xsl:template match="doc/arr" priority="100">
86
+ <tr>
87
+ <td class="name">
88
+ <xsl:value-of select="@name"/>
89
+ </td>
90
+ <td class="value">
91
+ <ul>
92
+ <xsl:for-each select="*">
93
+ <li><xsl:value-of select="."/></li>
94
+ </xsl:for-each>
95
+ </ul>
96
+ </td>
97
+ </tr>
98
+ </xsl:template>
99
+
100
+
101
+ <xsl:template match="doc/*">
102
+ <tr>
103
+ <td class="name">
104
+ <xsl:value-of select="@name"/>
105
+ </td>
106
+ <td class="value">
107
+ <xsl:value-of select="."/>
108
+ </td>
109
+ </tr>
110
+ </xsl:template>
111
+
112
+ <xsl:template match="*"/>
113
+
114
+ <xsl:template name="css">
115
+ <script>
116
+ function toggle(id) {
117
+ var obj = document.getElementById(id);
118
+ obj.style.display = (obj.style.display != 'block') ? 'block' : 'none';
119
+ }
120
+ </script>
121
+ <style type="text/css">
122
+ body { font-family: "Lucida Grande", sans-serif }
123
+ td.name { font-style: italic; font-size:80%; }
124
+ td { vertical-align: top; }
125
+ ul { margin: 0px; margin-left: 1em; padding: 0px; }
126
+ .note { font-size:80%; }
127
+ .doc { margin-top: 1em; border-top: solid grey 1px; }
128
+ .exp { display: none; font-family: monospace; white-space: pre; }
129
+ </style>
130
+ </xsl:template>
131
+
132
+ </xsl:stylesheet>
@@ -0,0 +1,67 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <!--
4
+ * Licensed to the Apache Software Foundation (ASF) under one or more
5
+ * contributor license agreements. See the NOTICE file distributed with
6
+ * this work for additional information regarding copyright ownership.
7
+ * The ASF licenses this file to You under the Apache License, Version 2.0
8
+ * (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ -->
19
+
20
+ <!--
21
+ Simple transform of Solr query results to Atom
22
+ -->
23
+
24
+ <xsl:stylesheet version='1.0'
25
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
26
+
27
+ <xsl:output
28
+ method="xml"
29
+ encoding="utf-8"
30
+ media-type="text/xml; charset=UTF-8"
31
+ />
32
+
33
+ <xsl:template match='/'>
34
+ <xsl:variable name="query" select="response/lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/>
35
+ <feed xmlns="http://www.w3.org/2005/Atom">
36
+ <title>Example Solr Atom 1.0 Feed</title>
37
+ <subtitle>
38
+ This has been formatted by the sample "example_atom.xsl" transform -
39
+ use your own XSLT to get a nicer Atom feed.
40
+ </subtitle>
41
+ <author>
42
+ <name>Apache Solr</name>
43
+ <email>solr-user@lucene.apache.org</email>
44
+ </author>
45
+ <link rel="self" type="application/atom+xml"
46
+ href="http://localhost:8983/solr/q={$query}&amp;wt=xslt&amp;tr=atom.xsl"/>
47
+ <updated>
48
+ <xsl:value-of select="response/result/doc[position()=1]/date[@name='timestamp']"/>
49
+ </updated>
50
+ <id>tag:localhost,2007:example</id>
51
+ <xsl:apply-templates select="response/result/doc"/>
52
+ </feed>
53
+ </xsl:template>
54
+
55
+ <!-- search results xslt -->
56
+ <xsl:template match="doc">
57
+ <xsl:variable name="id" select="str[@name='id']"/>
58
+ <entry>
59
+ <title><xsl:value-of select="str[@name='name']"/></title>
60
+ <link href="http://localhost:8983/solr/select?q={$id}"/>
61
+ <id>tag:localhost,2007:<xsl:value-of select="$id"/></id>
62
+ <summary><xsl:value-of select="arr[@name='features']"/></summary>
63
+ <updated><xsl:value-of select="date[@name='timestamp']"/></updated>
64
+ </entry>
65
+ </xsl:template>
66
+
67
+ </xsl:stylesheet>
@@ -0,0 +1,66 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <!--
4
+ * Licensed to the Apache Software Foundation (ASF) under one or more
5
+ * contributor license agreements. See the NOTICE file distributed with
6
+ * this work for additional information regarding copyright ownership.
7
+ * The ASF licenses this file to You under the Apache License, Version 2.0
8
+ * (the "License"); you may not use this file except in compliance with
9
+ * the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ -->
19
+
20
+ <!--
21
+ Simple transform of Solr query results to RSS
22
+ -->
23
+
24
+ <xsl:stylesheet version='1.0'
25
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
26
+
27
+ <xsl:output
28
+ method="xml"
29
+ encoding="utf-8"
30
+ media-type="text/xml; charset=UTF-8"
31
+ />
32
+ <xsl:template match='/'>
33
+ <rss version="2.0">
34
+ <channel>
35
+ <title>Example Solr RSS 2.0 Feed</title>
36
+ <link>http://localhost:8983/solr</link>
37
+ <description>
38
+ This has been formatted by the sample "example_rss.xsl" transform -
39
+ use your own XSLT to get a nicer RSS feed.
40
+ </description>
41
+ <language>en-us</language>
42
+ <docs>http://localhost:8983/solr</docs>
43
+ <xsl:apply-templates select="response/result/doc"/>
44
+ </channel>
45
+ </rss>
46
+ </xsl:template>
47
+
48
+ <!-- search results xslt -->
49
+ <xsl:template match="doc">
50
+ <xsl:variable name="id" select="str[@name='id']"/>
51
+ <xsl:variable name="timestamp" select="date[@name='timestamp']"/>
52
+ <item>
53
+ <title><xsl:value-of select="str[@name='name']"/></title>
54
+ <link>
55
+ http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
56
+ </link>
57
+ <description>
58
+ <xsl:value-of select="arr[@name='features']"/>
59
+ </description>
60
+ <pubDate><xsl:value-of select="$timestamp"/></pubDate>
61
+ <guid>
62
+ http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
63
+ </guid>
64
+ </item>
65
+ </xsl:template>
66
+ </xsl:stylesheet>