Bug 27627

Summary: Fix invalid HTML in OPAC results XSLT: change spans to divs
Product: Koha Reporter: Owen Leonard <oleonard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: bolshawh, fridolin.somers, kyle, lucas, martin.renvoize, testopia
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
22.05.00
Circulation function:
Bug Depends on: 27613    
Bug Blocks:    
Attachments: Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs
Bug 27627: (follow-up) Change one more span to div
Bug 27627: (follow-up) change div nested inside .type to span
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs

Description Owen Leonard 2021-02-04 17:04:22 UTC
There are many <span>s in MARC21slim2OPACResults.xsl which contain block-level elements, which is invalid. There's no reason for these not to be converted to <div>s.
Comment 1 Owen Leonard 2021-02-04 17:19:37 UTC
This bug is revealed but not caused by Bug 27613 because it adds <ul> to these spans. The validation error in question is:

Element ul not allowed as child of element span in this context.
Comment 2 Owen Leonard 2021-02-04 17:24:38 UTC
Created attachment 116330 [details] [review]
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs

This patch modifies the XSL template for OPAC search results in order to
improve HTML validation: Changing some <span>s to <div>s will prevent an
error when those <span>s contain block-level elements.

To test, apply the patch and restart_all if necessary.

- Confirm that OPACXSLTResultsDisplay is set to "default"
- Perform a catalog search in the OPAC.
- Validate the page source and confirm that there are no errors about
  "Element ul not allowed as child of element span in this context"

Note: another patch will address other validation errors.
Comment 3 Lucas Gass (lukeg) 2021-02-04 17:56:03 UTC
Created attachment 116332 [details] [review]
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs

This patch modifies the XSL template for OPAC search results in order to
improve HTML validation: Changing some <span>s to <div>s will prevent an
error when those <span>s contain block-level elements.

To test, apply the patch and restart_all if necessary.

- Confirm that OPACXSLTResultsDisplay is set to "default"
- Perform a catalog search in the OPAC.
- Validate the page source and confirm that there are no errors about
  "Element ul not allowed as child of element span in this context"

Note: another patch will address other validation errors.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Lucas Gass (lukeg) 2021-02-04 18:47:52 UTC
Owen, I signed off on this one too hastily. There is still one <span>, .results_summary .type that should be a <div>

Also, the display is now altered as each of the elements 'results_material_type', 'results_format', 'results_contents_literary' now displaying block instead of displaying inline 


https://snipboard.io/FNIiRL.jpg
Comment 5 Lucas Gass (lukeg) 2021-02-04 18:49:15 UTC
Created attachment 116334 [details] [review]
Bug 27627: (follow-up) Change one more span to div
Comment 6 Lucas Gass (lukeg) 2021-02-05 23:52:29 UTC
Created attachment 116438 [details] [review]
Bug 27627: (follow-up) change div nested inside .type  to span
Comment 7 Henry Bolshaw 2021-04-14 07:35:56 UTC
Hi Lucas and Owen, does this need signing off again? Have the issues Lucas raised been fixed by the follow-ups?

"Owen, I signed off on this one too hastily. There is still one <span>, .results_summary .type that should be a <div>

Also, the display is now altered as each of the elements 'results_material_type', 'results_format', 'results_contents_literary' now displaying block instead of displaying inline"
Comment 8 Katrin Fischer 2021-04-17 18:18:31 UTC
(In reply to Henry Bolshaw from comment #7)
> Hi Lucas and Owen, does this need signing off again? Have the issues Lucas
> raised been fixed by the follow-ups?
> 
> "Owen, I signed off on this one too hastily. There is still one <span>,
> .results_summary .type that should be a <div>
> 
> Also, the display is now altered as each of the elements
> 'results_material_type', 'results_format', 'results_contents_literary' now
> displaying block instead of displaying inline"

I think these sound like good catches - setting FQA
Comment 9 Owen Leonard 2021-11-08 15:54:52 UTC
Created attachment 127455 [details] [review]
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs

This patch modifies the XSL template for OPAC search results in order to
improve HTML validation: Changing some <span>s to <div>s will prevent an
error when those <span>s contain block-level elements.

To test, apply the patch and restart_all if necessary.

- Confirm that OPACXSLTResultsDisplay is set to "default"
- Perform a catalog search in the OPAC.
- Validate the page source and confirm that there are no errors about
  "Element ul not allowed as child of element span in this context"
Comment 10 Martin Renvoize (ashimema) 2021-11-11 15:07:26 UTC
Created attachment 127544 [details] [review]
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs

This patch modifies the XSL template for OPAC search results in order to
improve HTML validation: Changing some <span>s to <div>s will prevent an
error when those <span>s contain block-level elements.

To test, apply the patch and restart_all if necessary.

- Confirm that OPACXSLTResultsDisplay is set to "default"
- Perform a catalog search in the OPAC.
- Validate the page source and confirm that there are no errors about
  "Element ul not allowed as child of element span in this context"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2021-11-11 15:08:24 UTC
All works as expected now, nice bit of tidying up.
Comment 12 Katrin Fischer 2021-11-19 15:03:48 UTC
Right now waiting for its dependency.
Comment 13 Katrin Fischer 2022-02-21 21:25:52 UTC
Created attachment 130976 [details] [review]
Bug 27627: Fix invalid HTMl in OPAC results XSLT: change spans to divs

This patch modifies the XSL template for OPAC search results in order to
improve HTML validation: Changing some <span>s to <div>s will prevent an
error when those <span>s contain block-level elements.

To test, apply the patch and restart_all if necessary.

- Confirm that OPACXSLTResultsDisplay is set to "default"
- Perform a catalog search in the OPAC.
- Validate the page source and confirm that there are no errors about
  "Element ul not allowed as child of element span in this context"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Fridolin Somers 2022-02-24 23:07:43 UTC
We should do the same in OPAC details XSLT no ?
Comment 15 Fridolin Somers 2022-02-25 00:36:20 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑