diff --git a/metadata_xml/iso19115-cioos-template/main.j2 b/metadata_xml/iso19115-cioos-template/main.j2 index c8468c4..6774ea5 100644 --- a/metadata_xml/iso19115-cioos-template/main.j2 +++ b/metadata_xml/iso19115-cioos-template/main.j2 @@ -836,6 +836,7 @@ {# platform: Recommended #} + {% for platform in record['platform'] %} {# identifier: mandatory #} @@ -845,8 +846,8 @@ {# validation says cit:CI_Citation requires title #} - {{- bl.bilingual('cit:title', 'name', record['platform']) -}} - {% if record['platform']['role'] and record['platform']['authority'] %} + {{- bl.bilingual('cit:title', 'name', platform) -}} + {% if platform['role'] and platform['authority'] %} {# citedResponsibleParty: mandatory #} @@ -860,7 +861,7 @@ {# name: mandatory #} - {{- bl.bilingual('cit:name', 'authority', record['platform']) -}} + {{- bl.bilingual('cit:name', 'authority', platform) -}} {# CIOOS core mandatory element #} {# MI_Metadata/acquisitionInformation/MI_AcquisitionInformation/platform/MI_Platform/identifier/MD_Identifier/authority/CI_Citation/citedResponsibleParty/CI_Responsibility/party/CI_Party/name/CharacterString #} @@ -874,38 +875,36 @@ {# CIOOS core mandatory element #} {# MI_Metadata/acquisitionInformation/MI_AcquisitionInformation/platform/MI_Platform/identifier/MD_Identifier/code/CharacterString #} - {{- record['platform']['id'] -}} + {{- platform['id'] -}} {# description: mandatory #} {# CIOOS core mandatory element #} {# MI_Metadata/acquisitionInformation/MI_AcquisitionInformation/platform/MI_Platform/description/CharacterString #} - {{- bl.bilingual('mac:description', 'description', record['platform']) -}} + {{- bl.bilingual('mac:description', 'description', platform) -}} - {% for instrument in record['platform']['instruments'] %} + {% for instrument in platform['instruments'] %} {# instrument: Recommended, if platform not used then this should be under mac:MI_AcquisitionInformation #} - - {{- instr.get_instrument(instrument) -}} - + {{- instr.get_instrument(instrument) -}} {% endfor %} - {% if record['platform']['type'] %} - - {# cant have 'otherProperty' without 'instrument'. This adds dummy instrument #} - {% if instrument not in record['platform']['instruments']%} - - {% endif %} + {% if platform['type'] %} + {# cant have 'otherProperty' without 'instrument'. This adds dummy instrument #} + {% if platform['instruments']|length == 0 %} + + {% endif %} - {{- record['platform']['type'] -}} + {{- platform['type'] -}} {% endif %} + {% endfor %} {% endif %} diff --git a/sample_records/record.yml b/sample_records/record.yml index a71506d..bb86bd9 100644 --- a/sample_records/record.yml +++ b/sample_records/record.yml @@ -190,27 +190,27 @@ distribution: fr: resource description in French platform: - type: drifting subsurface profiling float - name: platform_name - authority: platform_authority - id: platform id - description: - en: platformDescription in English - fr: platformDescription in French - translations: - fr: - validated: true - message: Auto-translated using AWS - instruments: - - id: 123 - manufacturer: manufacturer en 1 - version: A1.53 - type: - en: type en 1 - fr: type fr 1 - description: - en: instrument description en 1 - fr: instrument description fr 1 + - type: drifting subsurface profiling float + name: platform_name + authority: platform_authority + id: platform id + description: + en: platformDescription in English + fr: platformDescription in French + translations: + fr: + validated: true + message: Auto-translated using AWS + instruments: + - id: 123 + manufacturer: manufacturer en 1 + version: A1.53 + type: + en: type en 1 + fr: type fr 1 + description: + en: instrument description en 1 + fr: instrument description fr 1 instruments: - id: id not in platform manufacturer: manufacturer not in platform