Skip to content

Latest commit

 

History

History
106 lines (66 loc) · 4.19 KB

File metadata and controls

106 lines (66 loc) · 4.19 KB

⚠️ Warning

This documentation is out of date and no longer maintained.

The reference and up to date documentation is available at: https://ec-jrc.github.io/datacite-to-dcat-ap/

How to use the XSLT

The XSLT can be run directly on the ouput of a OAI-PMH endpoint or on single metadata records, by using any of the programming languages supporting XSLT conversion.

The actual output of the XSLT depends on configuration parameters that specify:

  • whether to use the core or extended DataCite+DCAT-AP profile;
  • which spatial reference system to use for the geometry encoding of the bounding box (when available).
  • The HTTP URIs to be used for the metadata record and/or the described resource.

The following sections describe first the XSLT configuration parameters, and then give some examples on how to run the XSLT.

Configuration parameters

Parameter $profile

This parameter specifies the DataCite+DCAT-AP profile to be used:

  • value core: the DataCite+DCAT-AP core profile, which includes only the DataCite metadata elements supported in DCAT-AP.
  • value extended: the DataCite+DCAT-AP extended profile, which defines mappings for all the DataCite metadata elements.

The default value is: extended.

The mappings defined in the core and extended DataCite+DCAT-AP profiles are summarised in the Mappings document.

Parameters for the spatial reference system of the bounding box

These parameters denote the URI and URN, respectively, of the spatial reference system (SRS) used in the geometry encodings of the bounding box generated by the XSLT (WKT, GML, and GeoJSON). More precisely:

  • The SRS URI (parameter $SrsUri) is used in the WKT and GML encodings of the bounding box.
  • The SRS URN (parameter $SrsUrn) is used in the GeoJSON encoding of the bounding box.

The SRS URI's and URN's to be used are those operated by the OGC's registry:

The default SRS is CRS84 (WGS84 lon/lat). If a different SRS is used, the axis order (lat/lon or lon/lat) must be explicitly specified in parameter $SrsAxisOrder.

The possible values for parameter $SrsAxisOrder are the following:

  • LatLon: latitude / longitude.
  • LonLat: longitude / latitude.

As already mentioned, the axis order must be specified only if the reference SRS is different from CRS84. If the reference SRS is CRS84, the value specified in parameter $SrsAxisOrder is ignored.

Running the XSLT

This section provides examples of code from popular programming languages that can be used to run the XSLT.

PHP

<?php

// The URL of the XML document to be transformed. Here it corresponds to a "ListRecords" output of the DataCite OAI-PMH endpoint.
  $xmlURL = "http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_datacite";

// The URL pointing to the latest version of the XSLT.
  $xslURL = "https://raw.githubusercontent.com/ec-jrc/datacite-to-dcat-ap/master/datacite-to-dcat-ap.xsl";

  $xml = new DOMDocument;
  $xml->load($xmlURL) or die();

  $xsl = new DOMDocument;
  $xsl->load($xslURL) or die();

  $proc = new XSLTProcessor();
  $proc->importStyleSheet($xsl);

  echo $proc->transformToXML($xml);

?>

Python

import lxml.etree as ET

# The URL of the XML document to be transformed. Here it corresponds to a "ListRecords" output of the DataCite OAI-PMH endpoint.
xmlURL = "http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_datacite"

# The URL pointing to the latest version of the XSLT.
xslURL = "https://raw.githubusercontent.com/ec-jrc/datacite-to-dcat-ap/master/datacite-to-dcat-ap.xsl"

xml = ET.parse(xmlURL)
xsl = ET.parse(xslURL)

transform = ET.XSLT(xsl)

print(ET.tostring(transform(xml), pretty_print=True))

Java

TBD