metadata101 / iso19139.ca.HNAP

ISO Harmonized North American Profile (HNAP)
GNU General Public License v2.0
4 stars 19 forks source link

formatters not working for hnap. #49

Open ianwallen opened 4 years ago

ianwallen commented 4 years ago

I'm not sure where the formatters are used but they currently don't seem to be working.

Did a local build, went to metadata and template -> formatters and attempted to use the HNAP formatters and they all seem to fail with the loaded HNAP templates/sample data (b16db0fe-a4ec-4844-819e-630e33137b6d).

http://localhost:8080/geonetwork/srv/eng/md.format.xml?uuid=b16db0fe-a4ec-4844-819e-630e33137b6d&xsl=ec-view&schema=iso19139.ca.HNAP

<apiError>
<code>runtime_exception</code>
<description>Failed to compile stylesheet. 20 errors detected.</description>
<message>TransformerConfigurationException</message>
</apiError>

The following errors was logged to the console

Error at xsl:call-template on line 97 column 45 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 114 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 127 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 140 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 153 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 166 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 179 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 192 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 204 column 45 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 257 column 47 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 394 column 48 of view.xsl:
  XTSE0650: No template exists named parentCollection
Error at xsl:call-template on line 402 column 47 of view.xsl:
  XTSE0650: No template exists named relatedDatasets
Error at xsl:call-template on line 431 column 49 of view.xsl:
  XTSE0650: No template exists named thumbnail
Error at xsl:call-template on line 469 column 43 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 524 column 45 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 538 column 45 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 552 column 45 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 569 column 45 of view.xsl:
  XTSE0650: No template exists named showPanel
Error at xsl:call-template on line 590 column 57 of view.xsl:
  XTSE0650: No template exists named showMetadataExportIcons
Error at xsl:call-template on line 597 column 43 of view.xsl:
  XTSE0650: No template exists named showPanel

http://localhost:8080/geonetwork/srv/eng/md.format.xml?uuid=b16db0fe-a4ec-4844-819e-630e33137b6d&xsl=full_view&schema=iso19139.ca.HNAP

This page contains the following errors:
error on line 13 at column 78: Entity 'nbsp' not defined
Below is a rendering of the page up to the first error.
josegar74 commented 4 years ago

@ianwallen For HTML formatter, the url should be (see md.format.html instead of md.format.xml):

http://localhost:8080/geonetwork/srv/eng/md.format.html?uuid=093bac00-7a3e-44fa-801f-42144834e235&xsl=full_view&schema=iso19139.ca.HNAP

Doesn't seem really to work with xml format, but if you need xml version you can use the following url:

http://localhost:8080/geonetwork/srv/api/records/093bac00-7a3e-44fa-801f-42144834e235/formatters/xml

ianwallen commented 4 years ago

@josegar74 you are correct that the html formatter works better than the xml formatter. I was just pointing out that these interface seems to be buggy with these formatters. I would generally expect it to display a message saying that that formatter is unsupported or display something. But instead it is generating errors on the page and in the logs.

As I mentioned in the issue, I'm not sure where these formatter are used in the system. I have not seen any related issues other than in the administration section. As it is and administrator page, it is not a high priority for us at the moment as we only need to inform the administrator that this functionality is not currently working/buggy.

josegar74 commented 4 years ago

@ianwallen right, it's not related to HNAP, as fails also for iso19139, the md.format service accepts a format, but requires also to indicate the xslt that provides the response, that currently doesn't exists for xml.

I just remember we did this for other schema, see https://github.com/metadata101/iso19139.nl.geografie.2.0.0/tree/3.10.x/src/main/plugin/iso19139.nl.geografie.2.0.0/formatter/xml_view

This creates a html render with the xml content:

http://localhost:8080/geonetwork/srv/eng/md.format.xml?uuid=093bac00-7a3e-44fa-801f-42144834e235&xsl=xml_view&schema=iso19139

It can be added to HNAP, also to iso19139. But note that to retrieve the raw xml, you need to use http://localhost:8080/geonetwork/srv/api/records/093bac00-7a3e-44fa-801f-42144834e235/formatters/xml

ianwallen commented 4 years ago

@josegar74. Regarding "the md.format service accepts a format, but requires also to indicate the xslt that provides the response, that currently doesn't exists for xml."

I don't believe we need to created the xslt because to my knowledge we don't have a requirement for this functionality. However I think it would be good if the xslt that provides the response does not exist then it should simply return and error from the interface stating "required xslt does not exist" or "unsupported format" instead of "Failed to compile stylesheet. 20 errors detected" and a bunch of errors in the logs.

So better handling of the error would probably be a good fix for now.