I would like to customize the export as csv function in Geonetwork 3.8.1.
I know that the file to edit is the tpl-csv.xsl which, in my case, is located here
geonetwork/WEB-INF/data/config/schema_plugins/iso19115-3.2018/layout/tpl-csv.xsl
The output I would like to have is the following one:
"title","cloud coverage","category","date-creation"
"S2A_MSIL1C_20151127T103352_N0204_R108_T32TLS_20151127T103440","36.6172","dataset","2015-11-27T10:34:40"
I did some test but I'm only able to have
"schema","uuid","id","cit:title","gco:Real","category","date-creation"
"iso19115-3.2018","89d82f0a-051e-11ea-80ac-02000a08f492","1155","S2A_MSIL1C_20151127T103352_N0204_R108_T32TLS_20151127T103440","36.6172","dataset","2015-11-27T10:34:40",
How can I edit in a more correct way the tpl-csv.xsl?
I found the solution to customize the output of the EXPORT(CSV) function.
These are the two files to consider:
In the first one, as suggested to me by @josegar74, you have to add a similar line in between the abstract and category elements: myfieldvalue In my case I inserted:
About cloud coverage percentage in particular, please remember to add the namespace in the header because it is missing:
Then aI commented all the other lines I'm not interested in but:
About the second file, csv-search.xsl, I found that to avoid printing automatically the 3 columns:"schema","uuid","id", you have to comment the following lines:
and
In this way I had the possibility to get the desired output:
"uuid","title","cloud_coverage_percentage","category","date-creation" "c94da70e-066e-11ea-aa22-02000a08f492","S2A_MSIL1C_20180320T101021_N0206_R022_T33TUM_20180320T122057","36.0368","dataset","2018-03-20T12:20:57", "7caf22dc-066f-11ea-a038-02000a08f492","S2A_MSIL1C_20180320T101021_N0206_R022_T33TVN_20180320T122057","100.0","dataset","2018-03-20T12:20:57",
If you do not want to see the last comma after the last value (date-creation in my case) you can add a small piece of code at the end of the file:
I will try to open a pull request for this.
I hope this additional information could be useful for someone else.