metadata101 / iso19139.ca.HNAP

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

Add validation of extents #346

Closed ianwallen closed 11 months ago

ianwallen commented 11 months ago

Add validation of extents Also extents should be mandatory when gmd:spatialRepresentationType exists.

In the past some of validation was removed for the extents however I think it was incorrect. It was remove to support non spatial data however instead of removing it completely, it should have probably just been checked when gmd:spatialRepresentationType exists.

This fixes an issue where records would validate however when publishing to FGP, the record would fail due to extent validation issues. Since FGP required spatialRepresentationType, making the check only enforce the rules when spatialRepresentationType exists seems to fix the issue with FGP and also still works for non-spatial metadata which does not have spatialRepresentationType.

jodygarnett commented 11 months ago

I am having trouble running this:

Error happened while calling service Failed to compile stylesheet. 1 error detected.

Error on line 397 column 61 of inflate-metadata.xsl:
  SXXP0003: Error reported by XML parser: The prefix "gml" for element "gml:TimePeriod" is not bound.
2023-08-09 13:21:59,840 ERROR [geonetwork] - Failed to compile stylesheet. 1 error detected.
javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
    at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:176)
    at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139)
jodygarnett commented 11 months ago

I can find this commit https://github.com/metadata101/iso19139.ca.HNAP/commit/536c78cc650f810cfe7638400934dabace102bc4#diff-f70a3de7483485eb7a8adc9a5aba59c8378954b840ac025a162669ab962e6fd8 which removed a check for gmd:spatialRepresentationType.

I cannot see any reference to gml in the file history.

Adding gml fixes the issue:

xmlns:gml="http://www.opengis.net/gml/3.2"

⚠️ Looking at language-defaults.xsl a separate namespace is used for xml and gml320 specificly for TimePeriod:

                xmlns:gml="http://www.opengis.net/gml/3.2"
                xmlns:gml320="http://www.opengis.net/gml"

                <xsl:for-each select="gml:TimePeriod/gml:beginPosition|gml320:TimePeriod/gml320:beginPosition">
jodygarnett commented 11 months ago

@ianwallen I have pushed up a small fix and this PR is working for me locally now

ianwallen commented 11 months ago

I have addressed the issue I encountered and the editor now functions.

@jodygarnett It is odd that I did not get that error on my locale testing. In either case, your change looks good - Thank you.