Skip to content

Commit ced7c7a

Browse files
committed
UBO-438 Display citation in current lang; requires MyCoRe-Org/mycore#2743
1 parent 181acd9 commit ced7c7a

File tree

6 files changed

+53
-4
lines changed

6 files changed

+53
-4
lines changed

ubo-common/src/main/resources/META-INF/resources/index.xed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
</div>
7878
</article>
7979

80-
<xinclude uri="xslStyle:response-newest:solr:q=status%3Aconfirmed+AND+year%3A2025&amp;rows=4&amp;sort=created+desc,year+desc&amp;facet=false&amp;fl=id,year" />
80+
<xinclude uri="xslStyle:response-newest:solr:q=status%3Aconfirmed+AND+year%3A2025&amp;rows=4&amp;sort=created+desc,year+desc&amp;facet=false&amp;fl=id,year,cite,cite.de,cite.en" />
8181

8282
<aside id="sidebar">
8383
<xinclude uri="xslStyle:response-sidebar-mini:solr:q=status%3Aconfirmed&amp;rows=0" />

ubo-common/src/main/resources/config/ubo-common/solr/main/solr-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"q.op": "AND",
1212
"df": "all",
1313
"rows": 10,
14-
"fl": "id cite year genre host_genre oa_exact",
14+
"fl": "id cite cite.de cite.en year genre host_genre oa_exact",
1515
"facet": "true",
1616
"facet.mincount": "1",
1717
"facet.field": [

ubo-common/src/main/resources/config/ubo-common/solr/main/solr-schema.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,24 @@
755755
"stored": true
756756
}
757757
},
758+
{
759+
"add-field": {
760+
"name": "cite.de",
761+
"type": "string",
762+
"multiValued": false,
763+
"indexed": false,
764+
"stored": true
765+
}
766+
},
767+
{
768+
"add-field": {
769+
"name": "cite.en",
770+
"type": "string",
771+
"multiValued": false,
772+
"indexed": false,
773+
"stored": true
774+
}
775+
},
758776
{
759777
"add-dynamic-field": {
760778
"name": "host_id_*",

ubo-common/src/main/resources/xsl/response-newest.xsl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<xsl:include href="coreFunctions.xsl" />
1111

1212
<xsl:param name="ServletsBaseURL" />
13+
<xsl:param name="CurrentLang" />
1314

1415
<xsl:template match="/response">
1516
<xsl:variable name="originalQuery" select="lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/>
@@ -22,10 +23,21 @@
2223
<xsl:for-each select="result[@name='response']">
2324
<ul class="list-group">
2425
<xsl:for-each select="doc">
26+
<xsl:variable name="cite">
27+
<xsl:choose>
28+
<xsl:when test="str[@name=concat('cite.', $CurrentLang)]">
29+
<xsl:value-of select="str[@name=concat('cite.', $CurrentLang)]"/>
30+
</xsl:when>
31+
<xsl:otherwise>
32+
<xsl:value-of select="str[@name='cite']"/>
33+
</xsl:otherwise>
34+
</xsl:choose>
35+
</xsl:variable>
36+
2537
<li class="list-group-item">
2638
<xsl:variable name="id" select="str[@name='id']" />
2739
<div class="content bibentry ubo-hover-pointer" title="{i18n:translate('button.show')}" onclick="location.assign('{$WebApplicationBaseURL}servlets/DozBibEntryServlet?mode=show&amp;id={$id}');">
28-
<xsl:value-of select="str[@name='cite']" disable-output-escaping="yes"/>
40+
<xsl:value-of select="$cite" disable-output-escaping="yes"/>
2941
</div>
3042
</li>
3143
</xsl:for-each>

ubo-common/src/main/resources/xsl/response.xsl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<xsl:include href="coreFunctions.xsl" />
2323
<xsl:include href="csl-export-gui.xsl" />
2424

25+
<xsl:param name="CurrentLang" />
2526
<xsl:param name="RequestURL" />
2627
<xsl:param name="MCR.ORCID2.OAuth.ClientSecret" select="''" />
2728
<xsl:param name="MCR.ORCID2.OAuth.Scope" select="''" />
@@ -309,7 +310,17 @@
309310
<div class="hit card">
310311
<xsl:variable name="id" select="str[@name='id']" />
311312

312-
<xsl:variable name="cite" select="str[@name='cite']"/>
313+
<xsl:variable name="cite">
314+
<xsl:choose>
315+
<xsl:when test="str[@name=concat('cite.', $CurrentLang)]">
316+
<xsl:value-of select="str[@name=concat('cite.', $CurrentLang)]"/>
317+
</xsl:when>
318+
<xsl:otherwise>
319+
<xsl:value-of select="str[@name='cite']"/>
320+
</xsl:otherwise>
321+
</xsl:choose>
322+
</xsl:variable>
323+
313324
<xsl:variable name="label-year" select="int[@name='year']"/>
314325
<xsl:variable name="pub-type-categid" select="str[@name='genre']"/>
315326
<xsl:variable name="pub-type-host-categid" select="str[@name='host_genre']"/>

ubo-common/src/main/resources/xsl/ubo-solr.xsl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@
8282
<field name="cite">
8383
<xsl:apply-templates select="document(concat('xslTransform:mods2csl:mcrobject:', @ID))" mode="serialize"/>
8484
</field>
85+
86+
<field name="cite.de">
87+
<xsl:apply-templates select="document(concat('xslTransform:mods2csl?lang=de:mcrobject:', @ID))" mode="serialize"/>
88+
</field>
89+
90+
<field name="cite.en">
91+
<xsl:apply-templates select="document(concat('xslTransform:mods2csl?lang=en:mcrobject:', @ID))" mode="serialize"/>
92+
</field>
8593
</xsl:template>
8694

8795
<xsl:template name="sortby_person">

0 commit comments

Comments
 (0)