[GeoNetwork-devel] Problem with csw-postprocessing

Hello List

I’m trying to use postprocessing for csw output in GeoNetwork 3.12.x. I’ve checked that I have the code from https://github.com/geonetwork/core-geonetwork/pull/4493 in place, and I have exactly replicated the setup in that PR- namely an inspire source and a gmd-inspire-postprocessing.xsl file in myschema/present/csw directory. I’ve tested that the xpath expressions match elements in my test xml file. When I test it using the cURL request in the PR:

curl ‘http://localhost:8080/geonetwork/inspire/eng/csw’ -H ‘Content-type: application/xml’ --data-binary $‘<csw:GetRecordById xmlns:csw=“http://www.opengis.net/cat/csw/2.0.2”\n service=“CSW” version=“2.0.2”\n outputSchema=“http://www.isotc211.org/2005/gmd”>\n csw:ElementSetNamefull</csw:ElementSetName>\n csw:Id[myrecordUUID]</csw:Id>\n</csw:GetRecordById>’ --compressed

The changes don’t come through. However, if I apply them in myschema/present/csw/gmd-full.xsl then they work.

I’ve tested this using the standard docker 3.12 image, and also building from scratch and using jetty and get the same result in both cases. I assume I’m missing something fundamental about how the csw postprocessing is supposed to work?

Any help would be much appreciated.

All the best

Jo

Jo Cook
t:+44 7930 524 155/twitter:@archaeogeek
Please note that currently I do not work on Friday afternoons. For urgent responses at that time, please visit support.astuntechnology.com or phone our office on 01372 744009


Sign up to our mailing list for updates on news, products, conferences, events and training

Astun Technology Ltd, t:+44 1372 744 009 contact us online
web: astuntechnology.com twitter:@astuntech

iShare - enterprise geographic intelligence platform

GeoServer, PostGIS and QGIS training
Support

Company registration no. 5410695. Registered in England and Wales. Registered office: Penrose House, 67 Hightown Road, Banbury, OX16 9BE VAT no. 864201149.

Hi Jo

The CSW virtual endpoint should start with the prefix csw-, probably this is not really clear in the documentation.

I’ve created a virtual endpoint named csw-inspire and created a xslt file gmd-csw-inspire-postprocessing.xsl with a dummy content to set a different value for metadata standard name:

<xsl:stylesheet xmlns:xsl="[http://www.w3.org/1999/XSL/Transform](http://www.w3.org/1999/XSL/Transform)"
                xmlns:gco="[http://www.isotc211.org/2005/gco](http://www.isotc211.org/2005/gco)"
                xmlns:gmd="[http://www.isotc211.org/2005/gmd](http://www.isotc211.org/2005/gmd)"
                xmlns:srv="[http://www.isotc211.org/2005/srv](http://www.isotc211.org/2005/srv)"
                xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)"
                xmlns:geonet="[http://www.fao.org/geonetwork](http://www.fao.org/geonetwork)"
                exclude-result-prefixes="#all"
                version="2.0">

  <xsl:param name="displayInfo"/>

  <!-- Convert ISO profile elements to their base type -->
  <xsl:template match="*[@gco:isoType]" priority="99">
    <xsl:element name="{@gco:isoType}">
      <xsl:apply-templates select="@*[name() != 'gco:isoType']|*"/>
    </xsl:element>
  </xsl:template>

  **<xsl:template match="gmd:metadataStandardName" priority="100">**
**    <xsl:copy>**
**      <gco:CharacterString>INSPIRE postprocessing</gco:CharacterString>**
**    </xsl:copy>**
**  </xsl:template>**

  <xsl:template match="@*|node()[name(.)!='geonet:info']">
    <xsl:variable name="info" select="geonet:info"/>
    <xsl:copy>
      <xsl:apply-templates select="@*|node()[name(.)!='geonet:info']"/>
      <!-- GeoNetwork elements added when resultType is equal to results_with_summary -->
      <xsl:if test="$displayInfo = 'true'">
        <xsl:copy-of select="$info"/>
      </xsl:if>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>


Sending the following request to the csw-inspire endpoint it works fine for me:

<csw:GetRecords xmlns:csw="[http://www.opengis.net/cat/csw/2.0.2](http://www.opengis.net/cat/csw/2.0.2)"
                xmlns:gmd="[http://www.isotc211.org/2005/gmd](http://www.isotc211.org/2005/gmd)"
                service="CSW" version="2.0.2"
                resultType="results"
                outputSchema="[http://www.isotc211.org/2005/gmd](http://www.isotc211.org/2005/gmd)">
  <csw:Query typeNames="gmd:MD_Metadata">
    <csw:Constraint version="1.1.0">
      <Filter xmlns="[http://www.opengis.net/ogc](http://www.opengis.net/ogc)"/>
    </csw:Constraint>
  </csw:Query>
</csw:GetRecords>


Regards,
Jose García
···

Vriendelijke groeten / Kind regards,

Jose García


Veenderweg 13
6721 WD Bennekom
The Netherlands
T: +31 (0)318 416664

Please consider the environment before printing this email.

Hi Jo,

I’ve tried using a Docker image of GN 3.12.7 and it works as expected:

1 . Inside the container I’ve added a gmd-inspire-postprocessing.xsl in geonetwork/WEB-INF/data/config/schema_plugins/iso19139/present/csw with a xsl:message sentence.
2. I’ve created a new portal in Admin Console → Settings → Sources with inspire as identifier.
3. I’ve created an iso19139 record
4. I’ve published the record
5. With this curl command I get the response with the post-processing applied and I can see my message in the geonetwork log
curl ‘http://localhost:8080/geonetwork/inspire/eng/csw
-H ‘Content-type: application/xml’
–data-binary $‘<csw:GetRecordById xmlns:csw=“http://www.opengis.net/cat/csw/2.0.2” service=“CSW” version=“2.0.2” outputSchema=“http://www.isotc211.org/2005/gmd”>csw:ElementSetNamefull</csw:ElementSetName>csw:Id[myrecordUUID]</csw:Id>\n</csw:GetRecordById>’
–compressed

Best regards,
Juan Luis.

···


Vriendelijke groeten / Kind regards,

Juan Luis Rodríguez.


Veenderweg 13
6721 WD Bennekom
The Netherlands
T: +31 (0)318 416664

Please consider the environment before printing this email.

Hi Jose and Juan,

Thanks for checking this for me and confirming the approach I should be using. I’m not sure what I’ve done differently but today it’s working fine!

I wonder if we should put something about postprocessing in the documentation- perhaps here: https://geonetwork-opensource.org/manuals/trunk/en/api/csw.html

All the best

Jo

···

Jo Cook
t:+44 7930 524 155/twitter:@archaeogeek
Please note that currently I do not work on Friday afternoons. For urgent responses at that time, please visit support.astuntechnology.com or phone our office on 01372 744009