geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
412 stars 487 forks source link

CSV export does not use tpl-csv.xsl from relevant schema-plugin #4502

Open pvgenuchten opened 4 years ago

pvgenuchten commented 4 years ago

CSV export seems to always use the tpl.csv from generic iso19139

In 3.0 this behaviour was still fine, and using the xsl from current schema

josegar74 commented 4 years ago

See:

https://github.com/geonetwork/core-geonetwork/blob/e9c78902a1fc4b1a29a8197ac2e85bcdd310164a/web/src/main/webapp/xslt/services/csv/csv-search.xsl#L98-L100

https://github.com/geonetwork/core-geonetwork/blob/e9c78902a1fc4b1a29a8197ac2e85bcdd310164a/schemas/iso19139/src/main/plugin/iso19139/layout/tpl-csv.xsl#L41-L42

This way to manage the templates implicates that if the custom schema has a template with same match element, will be executed the template from the schema with higher priority for both profiles.

Some alternatives:

1) Define in the template some check of any custom element only defined in the custom schema and with higher priority than the iso19139 template, that should cause that the custom schema uses this template and iso19139 uses it's own template. Example:

<xsl:template mode="csv" 
match="gmd:MD_Metadata[count(gmd:contentInfo/gdpr:MD_ContentInfo) > 0]|
*[@gco:isoType='gmd:MD_Metadata' and count(gmd:contentInfo/gdpr:MD_ContentInfo) > 0]"
                priority="10">

2) Change the csv generation to use saxon to call a template with the schema name, instead of using mode, something similar as done in the metadata editor code:

https://github.com/geonetwork/core-geonetwork/blob/e9c78902a1fc4b1a29a8197ac2e85bcdd310164a/web/src/main/webapp/xslt/ui-metadata/edit/edit.xsl#L145-L147

pvgenuchten commented 4 years ago

+1 for opt 2