-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata editor - data identification dates - support only date format #272
base: 3.12.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" | ||
xmlns:gco="http://www.isotc211.org/2005/gco" | ||
xmlns:gmd="http://www.isotc211.org/2005/gmd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:geonet="http://www.fao.org/geonetwork" | ||
exclude-result-prefixes="#all"> | ||
|
||
<xsl:template match="gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:date/gmd:CI_Date/gmd:date[gco:Date and string-length(gco:Date) != 10]/gco:Date"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question? Is this required for the following as well?
We currently have issues when publishing this date to Open Data. It does not support single date as a year so we have to add the 01-01 as well. It is possible that this is an Open Data issues and not necessarily an HNAP issue so I'm just asking the question. |
||
|
||
<xsl:variable name="value" select="." /> | ||
|
||
<xsl:copy> | ||
<xsl:choose> | ||
<xsl:when test="matches($value, '^\d{4}$')"> | ||
<xsl:value-of select="concat($value, '-01-01')"/> | ||
</xsl:when> | ||
<xsl:when test="matches($value, '^\d{4}-(0[1-9]|1[0-2])$')"> | ||
<xsl:value-of select="concat($value, '-01')"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$value"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
|
||
</xsl:copy> | ||
|
||
</xsl:template> | ||
|
||
|
||
<!-- Do a copy of every nodes and attributes --> | ||
<xsl:template match="@*|node()"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*|node()"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<!-- Remove geonet:* elements. --> | ||
<xsl:template match="geonet:*" priority="2"/> | ||
</xsl:stylesheet> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed (and shown in your screenshot) the date format can be in different formats depending on locale so maybe this message should be changed to be more generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternate: