geonetwork / geonetwork/core-geonetwork
4.2.x: html-only version of records shows duplicate labels
- 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:

and here's how this displays in the generated page:

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
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