Skip to content

Updating a set of records using XSLT

Applying changes

Administrator user can use the catalog API to update a set of records with an XSLT transformation. The steps are the following:

At the end of the process, a summary describes:

  • Number of records to process
  • Number of records to processed
  • Number of records not found (in case one record gets deleted since the selection)
  • Number of records with errors
  • Number of records with process not defined in its standard
  • Number of records that current user can't edit

A process can also be applied to one metadata record using the md.processing service. eg. http://localhost:8080/geonetwork/srv/eng/md.processing?uuid=46eac9e4-33cb-45b7-a104-7bcc8e654c98&process=keywords-mapper&search=water&replace=Water

Parameters are:

  • uuid or id: the metadata UUID or the metadata internal identifier
  • process: The process identifier
  • add other extra parameters depending on the process (see below).

Adding batch process

Creating the processing file

Batch process are defined on a per schema basis. To check the list of available process for a standard check the <datadirectory>/config/schemaPlugins/<schemaId>/process folder.

The process folder contains a set of XSLT. The name of the XSLT file without extension is used to trigger the process. For example, if using md.processing.batch?process=my-custom-process, the process XSLT MUST be named my-custom-process.xsl.

Processing the XML of the record

The XSLT process will be applied to each metadata record in the selection. Each document will have as root element the metadata XML document with the geonet:info element. The geonet:info element contains metadata about the metadata. This element MUST be removed by the process to not alter the record when saved in the database.

    <geonet:info xmlns:geonet="">

Adding parameters

The XSLT process can retrieve parameters which may be provided in the URL using xsl:param. For example, if using md.processing.batch?process=my-custom-process&myParameter=test.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="" version="2.0"

    <xsl:param name="myParameter" select="''"/>

In this example, xsl:param will be accessible as a variable using $myParameter and it will have an empty value if not set by the URL parameter. To check that a parameter is properly set, use xsl:message to output information to the log file.

<xsl:param name="myParameter" select="''"/>
<xsl:message>myParameter: <xsl:value-of select="$myParameter"/></xsl:message>

The XSLT process also have access to catalog parameters:

  • guiLang: Current UI language
  • baseUrl: The service base URL (eg http://localhost:8080/geonetwork)
  • catalogUrl: The catalog URL (eg http://localhost:8080/geonetwork/srv/eng)
  • nodeId: The node identifier (default srv)

To use one of those parameters in the process, use xsl:param:

<xsl:param name="guiLang" select="''"/>

Making a copy is a minimum

A process MUST at least do:

  • a copy of everything
  • remove geonet:info metadata
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="" 
                xmlns:geonet="" version="2.0"

    <!-- Do a copy of every nodes and attributes recursively -->
    <xsl:template match="@*|node()">
            <xsl:apply-templates select="@*|node()"/>

    <!-- Remove geonet:* elements. -->
    <xsl:template match="geonet:*" priority="2"/>

Then customize the process to update the metadata record.

Processing examples

See schemas/iso19139/src/main/plugin/iso19139/process for examples.

On top of the minimum that the process MUST do, the process can define additional actions using new templates:

  • Removing an element. Eg. removing all report about DQ_TopologicalConsistency:
<xsl:template match="gmd:report[gmd:DQ_TopologicalConsistency]"

Set priority to 2 in order for your template to take priority over the main template making the copy of everything.

Registering a process as a suggestion

See Suggestion for improving metadata content.

Registering a process as an editor action

An XSLT process can be used in the editor to trigger specific actions. For example, the INSPIRE view display a button to add a resource identifier if none defined ending by the metadata identifier.

<action type="batch"
                          )]) = 0"/>

See ref:creating-custom-editor.

Adding XSLT conversion for import

Add XSL transformations to web/geonetwork/xsl/conversion/import folder in order to provide new import options to the user. Files can be added to this folder without restarting the application.