@fileIdentifier.CharacterString="metadata.custom.metadata-identifier"

# Verplicht INSPIRE en GDI-Vlaanderen, default 'dut'
language.LanguageCode.@codeList='http://www.loc.gov/standards/iso639-2/'
language.LanguageCode.@codeListValue=if_then_else(isNull("metadata.custom.metadata-language-code"), 'dut', "metadata.custom.metadata-language-code")
language.LanguageCode=if_then_else(isNull("metadata.custom.metadata-language"), 'Nederlands', "metadata.custom.metadata-language")

# Verplicht GDI-Vlaanderen, vast 'utf8'
characterSet.MD_CharacterSetCode.@codeList='http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_CharacterSetCode'
characterSet.MD_CharacterSetCode.@codeListValue='utf8'
characterSet.MD_CharacterSetCode='utf8'

parentIdentifier.CharacterString="metadata.custom.parent-identifier"

# Verplicht INSPIRE en GDI-Vlaanderen, vast 'dataset'
hierarchyLevel.MD_ScopeCode.@codeList='http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ScopeCode'
hierarchyLevel.MD_ScopeCode.@codeListValue='dataset'
hierarchyLevel.MD_ScopeCode='dataset'

hierarchyLevelName.CharacterString='dataset'

# Verplicht 1+ XSD, INSPIRE en GDI-Vlaanderen
contact%.CI_ResponsibleParty.organisationName.CharacterString="metadata.custom.metadata-contact/organisation"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.deliveryPoint.CharacterString="metadata.custom.metadata-contact/contactinfo/delivery-point"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.city.CharacterString="metadata.custom.metadata-contact/contactinfo/city"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.postalCode.CharacterString="metadata.custom.metadata-contact/contactinfo/postal-code"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.country.CharacterString="metadata.custom.metadata-contact/contactinfo/country"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.electronicMailAddress.CharacterString="metadata.custom.metadata-contact/contactinfo/email"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.phone.CI_Telephone.voice.CharacterString="metadata.custom.metadata-contact/contactinfo/telephone"
contact%.CI_ResponsibleParty.contactInfo.CI_Contact.onlineResource.CI_OnlineResource.linkage.URL="metadata.custom.metadata-contact/contactinfo/website"
contact%.CI_ResponsibleParty.role.CI_RoleCode.@codeList='http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode'
contact%.CI_ResponsibleParty.role.CI_RoleCode.@codeListValue=lapply("metadata.custom.metadata-contact/role", if_then_else(isNull("."), 'pointOfContact', "."))
contact%.CI_ResponsibleParty.role.CI_RoleCode=lapply("metadata.custom.metadata-contact/role", if_then_else(isNull("."), 'pointOfContact', "."))

# Verplicht XSD, INSPIRE en GDI-Vlaanderen, default datum van vandaag
$dateStamp.DateTime=if_then_else(isNull("metadata.custom._timestamp"), "Expression/NIL", dateFormat('YYYY-MM-dd''T''HH:mm:ss', "metadata.custom._timestamp"))


# Verplicht INSPIRE en GDI-Vlaanderen, standaard CRS van laag, kan uitgebreid worden in custom metadata
referenceSystemInfo[1].MD_ReferenceSystem.referenceSystemIdentifier.RS_Identifier.code.Anchor.@href=if_then_else(isNull("srs"), "Expression/NIL", concatenate('http://www.opengis.net/def/crs/EPSG/0/', strSubstringStart("srs", 5)))
referenceSystemInfo[1].MD_ReferenceSystem.referenceSystemIdentifier.RS_Identifier.code.Anchor="srs"

referenceSystemInfo%.MD_ReferenceSystem.referenceSystemIdentifier.RS_Identifier.code.Anchor.@href="metadata.custom.reference-system-code-ref"
referenceSystemInfo%.MD_ReferenceSystem.referenceSystemIdentifier.RS_Identifier.code.Anchor="metadata.custom.reference-system-code-label"


identificationInfo.MD_DataIdentification.@id=if_then_else(isNull("metadata.custom.data-identifier"), "Expression/NIL", concatenate('id-', "metadata.custom.data-identifier"))

# Verplicht XSD, INSPIRE en GDI-Vlaanderen
identificationInfo.MD_DataIdentification.citation.CI_Citation.title.CharacterString=if_then_else(isNull(title), name, title)

identificationInfo.MD_DataIdentification.citation.CI_Citation.alternateTitle.CharacterString="metadata.custom.alternate-title"

identificationInfo.MD_DataIdentification.citation.CI_Citation.date[1].CI_Date.date.Date=if_then_else(isNull("metadata.revisionDate"), "Expression/NIL", dateFormat('YYYY-MM-dd', "metadata.revisionDate"))
identificationInfo.MD_DataIdentification.citation.CI_Citation.date[1].CI_Date.dateType.CI_DateTypeCode.@codeList=if_then_else(isNull("metadata.revisionDate"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode')
identificationInfo.MD_DataIdentification.citation.CI_Citation.date[1].CI_Date.dateType.CI_DateTypeCode.@codeListValue=if_then_else(isNull("metadata.revisionDate"), "Expression/NIL", 'revision')
identificationInfo.MD_DataIdentification.citation.CI_Citation.date[1].CI_Date.dateType.CI_DateTypeCode=if_then_else(isNull("metadata.revisionDate"), "Expression/NIL", 'revision')
# Verplicht 1+ XSD, INSPIRE en GDI-Vlaanderen
identificationInfo.MD_DataIdentification.citation.CI_Citation.date%.CI_Date.date.Date=if_then_else(isNull("metadata.custom.data-date/date"), "Expression/NIL", literate("i", size("metadata.custom.data-date/date"), if_then_else(equalTo(litem("metadata.custom.data-date/date-type", "i"), 'revision'), if_then_else(isNull("metadata.revisionDate"), if_then_else(isNull(litem("metadata.custom.data-date/date", "i")), "Expression/NIL", dateFormat('YYYY-MM-dd', litem("metadata.custom.data-date/date", "i"))), "Expression/NIL"), if_then_else(isNull(litem("metadata.custom.data-date/date", "i")), "Expression/NIL", dateFormat('YYYY-MM-dd', litem("metadata.custom.data-date/date", "i"))))))
identificationInfo.MD_DataIdentification.citation.CI_Citation.date%.CI_Date.dateType.CI_DateTypeCode.@codeList=if_then_else(isNull("metadata.custom.data-date/date-type"), "Expression/NIL", literate("i", size("metadata.custom.data-date/date-type"), if_then_else(equalTo(litem("metadata.custom.data-date/date-type", "i"), 'revision'), if_then_else(isNull("metadata.revisionDate"), 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode', "Expression/NIL"), 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode')))
identificationInfo.MD_DataIdentification.citation.CI_Citation.date%.CI_Date.dateType.CI_DateTypeCode.@codeListValue=if_then_else(isNull("metadata.custom.data-date/date-type"), "Expression/NIL", literate("i", size("metadata.custom.data-date/date-type"), if_then_else(equalTo(litem("metadata.custom.data-date/date-type", "i"), 'revision'), if_then_else(isNull("metadata.revisionDate"), litem("metadata.custom.data-date/date-type", "i"), "Expression/NIL"), litem("metadata.custom.data-date/date-type", "i"))))
identificationInfo.MD_DataIdentification.citation.CI_Citation.date%.CI_Date.dateType.CI_DateTypeCode=if_then_else(isNull("metadata.custom.data-date/date-type"), "Expression/NIL", literate("i", size("metadata.custom.data-date/date-type"), if_then_else(equalTo(litem("metadata.custom.data-date/date-type", "i"), 'revision'), if_then_else(isNull("metadata.revisionDate"), litem("metadata.custom.data-date/date-type", "i"), "Expression/NIL"), litem("metadata.custom.data-date/date-type", "i"))))

identificationInfo.MD_DataIdentification.citation.CI_Citation.edition.CharacterString="metadata.custom.edition"

# Verplicht GDI-Vlaanderen
identificationInfo.MD_DataIdentification.citation.CI_Citation.identifier.MD_Identifier.code.CharacterString=if_then_else(isNull("metadata.custom.data-identifier"), "Expression/NIL", concatenate('http://localhost/dataset/', "metadata.custom.data-identifier"))

# Verplicht XSD, INSPIRE en GDI-Vlaanderen
identificationInfo.MD_DataIdentification.abstract.CharacterString=if_then_else(isNull(abstract), '', abstract)

identificationInfo.MD_DataIdentification.purpose.CharacterString="metadata.custom.purpose"

identificationInfo.MD_DataIdentification.status.MD_ProgressCode.@codeList=if_then_else(isNull("metadata.custom.status"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ProgressCode')
identificationInfo.MD_DataIdentification.status.MD_ProgressCode.@codeListValue="metadata.custom.status"
identificationInfo.MD_DataIdentification.status.MD_ProgressCode="metadata.custom.status"

identificationInfo.MD_DataIdentification.resourceMaintenance.MD_MaintenanceInformation.maintenanceAndUpdateFrequency.MD_MaintenanceFrequencyCode.@codeList=if_then_else(isNull("metadata.custom.update-frequency"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ProgressCode')
identificationInfo.MD_DataIdentification.resourceMaintenance.MD_MaintenanceInformation.maintenanceAndUpdateFrequency.MD_MaintenanceFrequencyCode.@codeListValue="metadata.custom.update-frequency"
identificationInfo.MD_DataIdentification.resourceMaintenance.MD_MaintenanceInformation.maintenanceAndUpdateFrequency.MD_MaintenanceFrequencyCode="metadata.custom.update-frequency"

# Verplicht GDI-Vlaanderen
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.organisationName.CharacterString="metadata.custom.data-contact/organisation"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.deliveryPoint.CharacterString="metadata.custom.data-contact/contactinfo/delivery-point"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.city.CharacterString="metadata.custom.data-contact/contactinfo/city"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.postalCode.CharacterString="metadata.custom.data-contact/contactinfo/postal-code"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.country.CharacterString="metadata.custom.data-contact/contactinfo/country"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.electronicMailAddress.CharacterString="metadata.custom.data-contact/contactinfo/email"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.phone.CI_Telephone.voice.CharacterString="metadata.custom.data-contact/contactinfo/telephone"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.contactInfo.CI_Contact.onlineResource.CI_OnlineResource.linkage.URL="metadata.custom.data-contact/contactinfo/website"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.role.CI_RoleCode.@codeList=lapply("metadata.custom.data-contact/role", if_then_else(isNull("."), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode'))
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.role.CI_RoleCode.@codeListValue="metadata.custom.data-contact/role"
identificationInfo.MD_DataIdentification.pointOfContact%.CI_ResponsibleParty.role.CI_RoleCode="metadata.custom.data-contact/role"

identificationInfo.MD_DataIdentification.graphicOverview.MD_BrowseGraphic.fileName.CharacterString=if_then_else(isNull("metadata.custom.graphic-overview-url"), concatenate('${url.wms}?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=false&STYLES&LAYERS=', "prefixedName", '&SRS=EPSG%3A31370&WIDTH=858&HEIGHT=330&BBOX=9518.482229747839%2C148172.73525929108%2C271454.8939534676%2C248854.86152133934'), concatenate('${url.wms}', "metadata.custom.graphic-overview-url", '&layers=', "prefixedName"))
identificationInfo.MD_DataIdentification.graphicOverview.MD_BrowseGraphic.fileType.CharacterString='png'

identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.keyword%.Anchor="metadata.custom.keyword-inspire-theme-label"
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.keyword%.Anchor.@href="metadata.custom.keyword-inspire-theme-ref"
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.@href=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", 'http://inspire.ec.europa.eu/id/citation/voc/gemet-inspire-themes-1.0')
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.CI_Citation.title.Anchor=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", 'GEMET - INSPIRE themes, version 1.0')
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.CI_Citation.title.Anchor.@href=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", 'http://www.eionet.europa.eu/gemet/inspire_themes')
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.date.Date=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", '2008-06-01')
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeList=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode')
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeListValue=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", 'publication')
identificationInfo.MD_DataIdentification.descriptiveKeywords[1].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode=if_then_else(isNull("metadata.custom.keyword-inspire-theme-label"), "Expression/NIL", 'publication')

identificationInfo.MD_DataIdentification.descriptiveKeywords[2].MD_Keywords.keyword%.CharacterString="metadata.custom.keyword-gemet-concept"
identificationInfo.MD_DataIdentification.descriptiveKeywords[2].MD_Keywords.thesaurusName.CI_Citation.title.CharacterString=if_then_else(isNull("metadata.custom.keyword-gemet-concept"), "Expression/NIL", 'GEMET - Concepten, versie 2.4')
identificationInfo.MD_DataIdentification.descriptiveKeywords[2].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.date.Date=if_then_else(isNull("metadata.custom.keyword-gemet-concept"), "Expression/NIL", '2010-01-13')
identificationInfo.MD_DataIdentification.descriptiveKeywords[2].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeList=if_then_else(isNull("metadata.custom.keyword-gemet-concept"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode')
identificationInfo.MD_DataIdentification.descriptiveKeywords[2].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeListValue=if_then_else(isNull("metadata.custom.keyword-gemet-concept"), "Expression/NIL", 'publication')
identificationInfo.MD_DataIdentification.descriptiveKeywords[2].MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode=if_then_else(isNull("metadata.custom.keyword-gemet-concept"), "Expression/NIL", 'publication')

identificationInfo.MD_DataIdentification.descriptiveKeywords[3].MD_Keywords.keyword%.CharacterString="metadata.custom.keyword-free"

identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.keyword%.CharacterString=if_then_else(isNull("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label"), "Expression/NIL", literate("i", size("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label"), if_then_else(isNull(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i")), "Expression/NIL", literate("j", size(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i")), if_then_else(isNull(litem(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-ref", "i"), "j")), litem(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i"), "j"), "Expression/NIL")))))
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.keyword%.Anchor=if_then_else(isNull("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label"), "Expression/NIL", literate("i", size("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label"), if_then_else(isNull(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i")), "Expression/NIL", literate("j", size(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i")), if_then_else(isNull(litem(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-ref", "i"), "j")), "Expression/NIL", litem(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i"), "j"))))))
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.keyword%.Anchor.@href=if_then_else(isNull("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label"), "Expression/NIL", literate("i", size("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label"), if_then_else(isNull(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i")), "Expression/NIL", literate("j", size(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-label", "i")), if_then_else(isNull(litem(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-ref", "i"), "j")), "Expression/NIL", litem(litem("metadata.custom.keyword-custom-thesaurus/keyword/keyword-ref", "i"), "j"))))))

identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.@href="metadata.custom.keyword-custom-thesaurus/thesaurus-citation-ref"
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.title.CharacterString=if_then_else(isNull("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label"), "Expression/NIL", literate("i", size("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label"), if_then_else(isNull(litem("metadata.custom.keyword-custom-thesaurus/thesaurus-title-ref", "i")), litem("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label", "i"), "Expression/NIL")))
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.title.Anchor=if_then_else(isNull("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label"), "Expression/NIL", literate("i", size("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label"), if_then_else(isNull(litem("metadata.custom.keyword-custom-thesaurus/thesaurus-title-ref", "i")), "Expression/NIL", litem("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label", "i"))))
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.title.Anchor.@href=if_then_else(isNull("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label"), "Expression/NIL", literate("i", size("metadata.custom.keyword-custom-thesaurus/thesaurus-title-label"), if_then_else(isNull(litem("metadata.custom.keyword-custom-thesaurus/thesaurus-title-ref", "i")), "Expression/NIL", litem("metadata.custom.keyword-custom-thesaurus/thesaurus-title-ref", "i"))))
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.date.Date=lapply("metadata.custom.keyword-custom-thesaurus/thesaurus-date", if_then_else(isNull("."), "Expression/NIL", dateFormat('YYYY-MM-dd', ".")))
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode="metadata.custom.keyword-custom-thesaurus/thesaurus-date-type"
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeListValue="metadata.custom.keyword-custom-thesaurus/thesaurus-date-type"
identificationInfo.MD_DataIdentification.descriptiveKeywords%.MD_Keywords.thesaurusName.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeList=lapply("metadata.custom.keyword-custom-thesaurus/thesaurus-date-type", if_then_else(isNull("."), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode'))

# Verplicht GDI-Vlaanderen
identificationInfo.MD_DataIdentification.resourceConstraints[1].MD_Constraints.useLimitation%.CharacterString="metadata.custom.rc-rc-use-limitation"

identificationInfo.MD_DataIdentification.resourceConstraints[2].MD_LegalConstraints.accessConstraints.MD_RestrictionCode.@codeListValue="metadata.custom.rc-lim-access-constraint"
identificationInfo.MD_DataIdentification.resourceConstraints[2].MD_LegalConstraints.accessConstraints.MD_RestrictionCode.@codeList=if_then_else(isNull("metadata.custom.rc-lim-access-constraint"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_RestrictionCode')
identificationInfo.MD_DataIdentification.resourceConstraints[2].MD_LegalConstraints.accessConstraints.MD_RestrictionCode="metadata.custom.rc-lim-access-constraint"
identificationInfo.MD_DataIdentification.resourceConstraints[2].MD_LegalConstraints.otherConstraints%.Anchor="metadata.custom.rc-lim-other-constraint-label"
identificationInfo.MD_DataIdentification.resourceConstraints[2].MD_LegalConstraints.otherConstraints%.Anchor.@href="metadata.custom.rc-lim-other-constraint-ref"

identificationInfo.MD_DataIdentification.resourceConstraints[3].MD_LegalConstraints.useConstraints.MD_RestrictionCode.@codeListValue="metadata.custom.rc-con-use-constraint"
identificationInfo.MD_DataIdentification.resourceConstraints[3].MD_LegalConstraints.useConstraints.MD_RestrictionCode.@codeList=if_then_else(isNull("metadata.custom.rc-con-use-constraint"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_RestrictionCode')
identificationInfo.MD_DataIdentification.resourceConstraints[3].MD_LegalConstraints.useConstraints.MD_RestrictionCode="metadata.custom.rc-con-use-constraint"
identificationInfo.MD_DataIdentification.resourceConstraints[3].MD_LegalConstraints.otherConstraints%.CharacterString=if_then_else( isNull("metadata.custom.rc-con-other-constraint/other-constraint-label"), "Expression/NIL", literate("i", size("metadata.custom.rc-con-other-constraint/other-constraint-label"),   if_then_else( isNull(litem("metadata.custom.rc-con-other-constraint/other-constraint-label", "i")), "Expression/NIL", if_then_else( isNull(litem("metadata.custom.rc-con-other-constraint/other-constraint-ref", "i")), litem("metadata.custom.rc-con-other-constraint/other-constraint-label", "i"), "Expression/NIL" ) ) ) )
identificationInfo.MD_DataIdentification.resourceConstraints[3].MD_LegalConstraints.otherConstraints%.Anchor=if_then_else( isNull("metadata.custom.rc-con-other-constraint/other-constraint-label"), "Expression/NIL", literate("i", size("metadata.custom.rc-con-other-constraint/other-constraint-label"),   if_then_else( isNull(litem("metadata.custom.rc-con-other-constraint/other-constraint-label", "i")), "Expression/NIL", if_then_else( isNull(litem("metadata.custom.rc-con-other-constraint/other-constraint-ref", "i")), "Expression/NIL", litem("metadata.custom.rc-con-other-constraint/other-constraint-label", "i") ) ) ) ) 
identificationInfo.MD_DataIdentification.resourceConstraints[3].MD_LegalConstraints.otherConstraints%.Anchor.@href=if_then_else( isNull("metadata.custom.rc-con-other-constraint/other-constraint-label"), "Expression/NIL", literate("i", size("metadata.custom.rc-con-other-constraint/other-constraint-label"),   if_then_else( isNull(litem("metadata.custom.rc-con-other-constraint/other-constraint-label", "i")), "Expression/NIL", if_then_else( isNull(litem("metadata.custom.rc-con-other-constraint/other-constraint-ref", "i")), "Expression/NIL", litem("metadata.custom.rc-con-other-constraint/other-constraint-ref", "i") ) ) ) )

identificationInfo.MD_DataIdentification.spatialRepresentationType.MD_SpatialRepresentationTypeCode.@codeList='http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_SpatialRepresentationTypeCode'
identificationInfo.MD_DataIdentification.spatialRepresentationType.MD_SpatialRepresentationTypeCode.@codeListValue=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), 'vector', 'grid')
identificationInfo.MD_DataIdentification.spatialRepresentationType.MD_SpatialRepresentationTypeCode=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), 'vector', 'grid')

identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.equivalentScale.MD_RepresentativeFraction.denominator.Integer=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), "metadata.custom.resolution-equivalent-scale", "Expression/NIL")
identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.distance.Distance=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), "Expression/NIL", numberFormat(if_then_else(equalTo("CRS.coordinateSystem.axis[1].unit", '\u00B0'), '0.0000', '0.00'), "grid.gridToCRS.scaleX"))
identificationInfo.MD_DataIdentification.spatialResolution.MD_Resolution.distance.Distance.@uom=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), "Expression/NIL", if_then_else(equalTo("CRS.coordinateSystem.axis[1].unit", 'm'), 'meter', if_then_else(equalTo("CRS.coordinateSystem.axis[1].unit", '\u00B0'), 'degree', "CRS.coordinateSystem.axis[1].unit")))

# Verplicht 1+ XSD, INSPIRE en GDI-Vlaanderen, default 'dut'
identificationInfo.MD_DataIdentification.language.LanguageCode.@codeList='http://www.loc.gov/standards/iso639-2/'
identificationInfo.MD_DataIdentification.language.LanguageCode.@codeListValue=if_then_else(isNull("metadata.custom.data-language-code"), 'dut', "metadata.custom.data-language-code")
identificationInfo.MD_DataIdentification.language.LanguageCode=if_then_else(isNull("metadata.custom.data-language"), 'Nederlands', "metadata.custom.data-language")

# Verplicht INSPIRE en GDI-Vlaanderen, default 'geoscientificInformation'
identificationInfo.MD_DataIdentification.topicCategory%.MD_TopicCategoryCode=if_then_else(isNull("metadata.custom.topic-category[1]"), 'geoscientificInformation', "metadata.custom.topic-category")

identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.extent.TimePeriod.@id=if_then_else(isNull("metadata.custom.data-valid-date/start-date"), "Expression/NIL", 'timePeriod')
identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.extent.TimePeriod.beginPosition=if_then_else(isNull("metadata.custom.data-valid-date/start-date"), "Expression/NIL", dateFormat('YYYY-MM-dd', "metadata.custom.data-valid-date/start-date"))
identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.extent.TimePeriod.beginPosition.@indeterminatePosition=if_then_else(isNull("metadata.custom.data-valid-date/end-date"), "Expression/NIL", if_then_else(isNull("metadata.custom.data-valid-date/start-date"), 'unknown', "Expression/NIL"))
identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.extent.TimePeriod.endPosition=if_then_else(isNull("metadata.custom.data-valid-date/end-date"), "Expression/NIL", dateFormat('YYYY-MM-dd', "metadata.custom.data-valid-date/end-date"))
identificationInfo.MD_DataIdentification.extent.EX_Extent.temporalElement.EX_TemporalExtent.extent.TimePeriod.endPosition.@indeterminatePosition=if_then_else(isNull("metadata.custom.data-valid-date/start-date"), "Expression/NIL", if_then_else(isNull("metadata.custom.data-valid-date/end-date"), 'unknown', "Expression/NIL"))

identificationInfo.MD_DataIdentification.supplementalInformation.CharacterString="metadata.custom.supplemental-information"

identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.specificUsage.CharacterString="metadata.custom.specific-usage/usage"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.organisationName.CharacterString="metadata.custom.specific-usage/user-contact/organisation"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.deliveryPoint.CharacterString="metadata.custom.specific-usage/user-contact/contactinfo/delivery-point"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.city.CharacterString="metadata.custom.specific-usage/user-contact/contactinfo/city"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.postalCode.CharacterString="metadata.custom.specific-usage/user-contact/contactinfo/postal-code"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.country.CharacterString="metadata.custom.specific-usage/user-contact/contactinfo/country"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.electronicMailAddress.CharacterString="metadata.custom.specific-usage/user-contact/contactinfo/email"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.phone.CI_Telephone.voice.CharacterString="metadata.custom.specific-usage/user-contact/contactinfo/telephone"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.contactInfo.CI_Contact.onlineResource.CI_OnlineResource.linkage.URL="metadata.custom.specific-usage/user-contact/contactinfo/website"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.role.CI_RoleCode.@codeList=lapply("metadata.custom.specific-usage/user-contact/role", if_then_else(isNull("."), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode'))
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.role.CI_RoleCode.@codeListValue="metadata.custom.specific-usage/user-contact/role"
identificationInfo.MD_DataIdentification.resourceSpecificUsage%.MD_Usage.userContactInfo%.CI_ResponsibleParty.role.CI_RoleCode="metadata.custom.specific-usage/user-contact/role"

contentInfo.MD_FeatureCatalogueDescription.includedWithDataset.Boolean=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", 'true')
contentInfo.MD_FeatureCatalogueDescription.featureTypes.LocalName=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", concatenate("name", 'Type'))
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.@uuidref=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", "metadata.custom.feature-catalog/feature-catalog-identifier")
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.CI_Citation.title.CharacterString=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", concatenate(if_then_else(isNull(title), name, title), ' (objectencatalogus)'))
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.CI_Citation.edition.CharacterString=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", if_then_else(isNull("metadata.custom.edition") , '1', "metadata.custom.edition"))
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.CI_Citation.date.CI_Date.date.Date=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", if_then_else(isNull("metadata.custom._timestamp"), "Expression/NIL", dateFormat('YYYY-MM-dd', "metadata.custom._timestamp")))
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeList=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode')
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeListValue=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", 'creation')
contentInfo.MD_FeatureCatalogueDescription.featureCatalogueCitation.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode=if_then_else(isNull("metadata.custom.feature-catalog/feature-catalog-identifier"), "Expression/NIL", 'creation')

distributionInfo.MD_Distribution.distributionFormat.MD_Format.name.CharacterString=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), 'GML', 'GeoTIFF')
distributionInfo.MD_Distribution.distributionFormat.MD_Format.version.CharacterString=if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), '3.1.1', '1.0')

distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.organisationName.CharacterString="metadata.custom.distributor/organisation"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.deliveryPoint.CharacterString="metadata.custom.distributor/contactinfo/delivery-point"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.city.CharacterString="metadata.custom.distributor/contactinfo/city"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.postalCode.CharacterString="metadata.custom.distributor/contactinfo/postal-code"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.country.CharacterString="metadata.custom.distributor/contactinfo/country"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.electronicMailAddress.CharacterString="metadata.custom.distributor/contactinfo/email"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.phone.CI_Telephone.voice.CharacterString="metadata.custom.distributor/contactinfo/telephone"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.contactInfo.CI_Contact.onlineResource.CI_OnlineResource.linkage.URL="metadata.custom.distributor/contactinfo/website"
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.role.CI_RoleCode.@codeList=lapply("metadata.custom.distributor/role", if_then_else(isNull("."), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode'))
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.role.CI_RoleCode.@codeListValue=lapply("metadata.custom.distributor/role", if_then_else(isNull("."), 'distributor', "."))
distributionInfo.MD_Distribution.distributor%.MD_Distributor.distributorContact.CI_ResponsibleParty.role.CI_RoleCode=lapply("metadata.custom.distributor/role", if_then_else(isNull("."), 'distributor', "."))

distributionInfo.MD_Distribution.distributor.MD_Distributor.distributionOrderProcess.MD_StandardOrderProcess.fees.CharacterString='Gratis'

distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.linkage.URL=list(concatenate('${url.wms}', '?'), concatenate('${url.wms}', '?SERVICE=WMS&version=1.3.0&request=GetCapabilities'), concatenate('${url.wms}', '?SERVICE=WMS&version=1.3.0&request=GetMap'), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), concatenate('${url.wfs}', '?'), concatenate('${url.wcs}', '?')), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), concatenate('${url.wfs}', '?SERVICE=WFS&version=1.1.0&request=GetCapabilities'), concatenate('${url.wcs}', '?SERVICE=WCS&version=1.1.1&request=GetCapabilities')), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), concatenate('${url.wfs}', '?SERVICE=WFS&version=1.1.0&request=GetFeature'), concatenate('${url.wcs}', '?SERVICE=WCS&version=1.1.1&request=GetCoverage')), concatenate('${url.wms}', '/kml?layers=', "prefixedName"), if_then_else(isCached("."), concatenate('${url.wmts}', '?'), "Expression/NIL"), if_then_else(isCached("."), concatenate('${url.wmts}', '?REQUEST=GetCapabilities'), "Expression/NIL"), if_then_else(isCached("."), concatenate('${url.wmts}', '?REQUEST=GetTile'), "Expression/NIL"), "metadata.custom.transfer-option/linkage")
distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.protocol.CharacterString=list( 'OGC:WMS', 'OGC:WMS-1.3.0-http-get-capabilities', 'OGC:WMS-1.3.0-http-get-map', if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), 'OGC:WFS', 'OGC:WCS'), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), 'OGC:WFS-1.1.0-http-get-capabilities', 'OGC:WCS-1.1.1-http-get-capabilities'), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), 'OGC:WFS-1.1.0-http-get-feature', 'OGC:WCS-1.1.1-http-get-coverage'), 'GLG:KML-2.0-http-get-map', if_then_else(isCached("."), 'OGC:WMTS', "Expression/NIL"), if_then_else(isCached("."), 'OGC:WMTS-1.0.0-http-get-capabilities', "Expression/NIL"), if_then_else(isCached("."), 'OGC:WMTS-1.0.0-http-get-tile', "Expression/NIL"), "metadata.custom.transfer-option/protocol")
distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.name.CharacterString=list( "prefixedName", "prefixedName", "prefixedName", if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), "prefixedName", "name"), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), "prefixedName", "name"), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), "prefixedName", "name"), "prefixedName", if_then_else(isCached("."), "prefixedName", "Expression/NIL"), if_then_else(isCached("."), "prefixedName", "Expression/NIL"), if_then_else(isCached("."), "prefixedName", "Expression/NIL"), "metadata.custom.transfer-option/transfer-name")
distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.description.CharacterString=list( concatenate('WMS-endpoint ', "title"), concatenate('WMS-capabilities ', title), concatenate('WMS-map ', title), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), concatenate('WFS-endpoint ', "title"), concatenate('WCS-endpoint ', "title")), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), concatenate('WFS-capabilities ', "title"), concatenate('WCS-capabilities ', "title")), if_then_else(equalto(typeof("."), 'FeatureTypeInfo'), concatenate('WFS-feature ', "title"), concatenate('WCS-coverage ', "title")), concatenate('KML ', title), if_then_else(isCached("."), concatenate('WMTS-endpoint ', "title"), "Expression/NIL"), if_then_else(isCached("."), concatenate('WMTS-capabilities ', "title"), "Expression/NIL"), if_then_else(isCached("."), concatenate('WMTS-tile ', "title"), "Expression/NIL"), "metadata.custom.transfer-option/transfer-description")
distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.function.CI_OnLineFunctionCode.@codeList=lapply(list( "Expression/NIL", "Expression/NIL", "Expression/NIL", 'download', 'download', 'download', "Expression/NIL", "Expression/NIL", "Expression/NIL", "Expression/NIL", "metadata.custom.transfer-option/transfer-function"), if_then_else(isNull("."), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_OnLineFunctionCode'))
distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.function.CI_OnLineFunctionCode.@codeListValue=list( "Expression/NIL", "Expression/NIL", "Expression/NIL", 'download', 'download', 'download', "Expression/NIL", "Expression/NIL", "Expression/NIL", "Expression/NIL", "metadata.custom.transfer-option/transfer-function")
distributionInfo.MD_Distribution.transferOptions.MD_DigitalTransferOptions.onLine%.CI_OnlineResource.function.CI_OnLineFunctionCode=list( "Expression/NIL", "Expression/NIL", "Expression/NIL", 'download', 'download', 'download', "Expression/NIL", "Expression/NIL", "Expression/NIL", "Expression/NIL", "metadata.custom.transfer-option/transfer-function")

# Verplicht INSPIRE en GDI-Vlaanderen
dataQualityInfo.DQ_DataQuality.scope.DQ_Scope.level.MD_ScopeCode.@codeList='http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_ScopeCode'
dataQualityInfo.DQ_DataQuality.scope.DQ_Scope.level.MD_ScopeCode.@codeListValue='dataset'
dataQualityInfo.DQ_DataQuality.scope.DQ_Scope.level.MD_ScopeCode='dataset'

# Verplicht INSPIRE en GDI-Vlaanderen
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.@href="metadata.custom.data-quality-conformance/specification-ref"
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.title.CharacterString=if_then_else(isNull("metadata.custom.data-quality-conformance/title-ref"), "metadata.custom.data-quality-conformance/title-label", "Expression/NIL")
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.title.Anchor=if_then_else(isNull("metadata.custom.data-quality-conformance/title-ref"), "Expression/NIL", "metadata.custom.data-quality-conformance/title-label")
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.title.Anchor.@href="metadata.custom.data-quality-conformance/title-ref"
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.date.CI_Date.date.Date=if_then_else(isNull("metadata.custom.data-quality-conformance/date"), "Expression/NIL", dateFormat('YYYY-MM-dd', "metadata.custom.data-quality-conformance/date"))
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeList=if_then_else(isNull("metadata.custom.data-quality-conformance/date-type"), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_DateTypeCode')
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode.@codeListValue="metadata.custom.data-quality-conformance/date-type"
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.specification.CI_Citation.date.CI_Date.dateType.CI_DateTypeCode="metadata.custom.data-quality-conformance/date-type"
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.explanation.CharacterString="metadata.custom.data-quality-conformance/explanation"
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.pass.Boolean=if_then_else(equalTo("metadata.custom.data-quality-conformance/pass", ''), "Expression/NIL", "metadata.custom.data-quality-conformance/pass")
dataQualityInfo.DQ_DataQuality.report.DQ_DomainConsistency.result.DQ_ConformanceResult.pass.@nilReason=if_then_else(isNull("metadata.custom.data-quality-conformance/title-label"), "Expression/NIL", if_then_else(equalTo("metadata.custom.data-quality-conformance/pass", ''), 'unknown', "Expression/NIL"))


# Verplicht GDI-Vlaanderen
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.statement.CharacterString="metadata.custom.lineage-statement"

dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.source.LI_Source.description.CharacterString="metadata.custom.lineage-source"

dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.description.CharacterString="metadata.custom.data-quality-process-step/description"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.rationale.CharacterString="metadata.custom.data-quality-process-step/rationale"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.dateTime.DateTime=lapply("metadata.custom.data-quality-process-step/datetime", if_then_else(isNull("."), "Expression/NIL", dateFormat('YYYY-MM-dd''T''HH:mm:ss', ".")))

dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.organisationName.CharacterString="metadata.custom.data-quality-process-step/processor/organisation"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.deliveryPoint.CharacterString="metadata.custom.data-quality-process-step/processor/contactinfo/delivery-point"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.city.CharacterString="metadata.custom.data-quality-process-step/processor/contactinfo/city"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.postalCode.CharacterString="metadata.custom.data-quality-process-step/processor/contactinfo/postal-code"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.country.CharacterString="metadata.custom.data-quality-process-step/processor/contactinfo/country"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.address.CI_Address.electronicMailAddress.CharacterString="metadata.custom.data-quality-process-step/processor/contactinfo/email"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.phone.CI_Telephone.voice.CharacterString="metadata.custom.data-quality-process-step/processor/contactinfo/telephone"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.contactInfo.CI_Contact.onlineResource.CI_OnlineResource.linkage.URL="metadata.custom.data-quality-process-step/processor/contactinfo/website"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.role.CI_RoleCode.@codeList=lapply("metadata.custom.data-quality-process-step/processor/role", if_then_else(isNull("."), "Expression/NIL", 'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#CI_RoleCode'))
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.role.CI_RoleCode.@codeListValue="metadata.custom.data-quality-process-step/processor/role"
dataQualityInfo.DQ_DataQuality.lineage.LI_Lineage.processStep%.LI_ProcessStep.processor%.CI_ResponsibleParty.role.CI_RoleCode="metadata.custom.data-quality-process-step/processor/role"