geonetwork / geonetwork/core-geonetwork

4.2.x: html-only version of records shows duplicate labels

Open
#6,898 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
521
Forks
514
Avg merge
6d 13h
Merged PRs (30d)
19

Description

**Describe the bug**
If there are multiple labels defined for an element in a schema's `labels.xml` then the html-only view (/srv/api/records/) shows all the labels as titles. I think this is related to https://github.com/geonetwork/core-geonetwork/blob/main/web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-layout.xsl#L424-L439 but I'm not 100% sure.

I've mocked up an example to show this- here's the relevant section from my labels.xml:
![Screenshot from 2023-03-09 09-36-46](https://user-images.githubusercontent.com/1544849/223981323-42e5b7d9-77da-48e1-8235-4d4abbfed229.png)

and here's how this displays in the generated page:
![Screenshot from 2023-03-09 09-37-52](https://user-images.githubusercontent.com/1544849/223981561-c6dcc2be-ad91-4747-8c76-393b33642b76.png)

I can work around this by ensuring I only have one `` element in `labels.xml,` but ideally the function in `render-layout.xsl` should respect the context attribute.

Contributor guide

Open the contributing guide

Research direction

Start with web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-layout.xsl, especially lines 424-439, and reproduce the html-only response at /srv/api/records/ using a schema whose labels.xml defines multiple labels for one element. Check how the context attribute is handled; done means the generated page shows only the applicable label rather than duplicate titles.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.