diff --git a/pycsw/plugins/profiles/apiso/apiso.py b/pycsw/plugins/profiles/apiso/apiso.py index 97fade44a..345b67ed1 100644 --- a/pycsw/plugins/profiles/apiso/apiso.py +++ b/pycsw/plugins/profiles/apiso/apiso.py @@ -688,13 +688,19 @@ def write_record(self, result, esn, outputschema, queryables, caps=None): etree.SubElement(linkage, util.nspath_eval('gmd:URL', self.namespaces)).text = link['url'] protocol = etree.SubElement(online2, util.nspath_eval('gmd:protocol', self.namespaces)) - etree.SubElement(protocol, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link['protocol'] + etree.SubElement(protocol, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link.get('protocol', 'WWW:LINK') - name = etree.SubElement(online2, util.nspath_eval('gmd:name', self.namespaces)) - etree.SubElement(name, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link['name'] + if 'name' in link: + name = etree.SubElement(online2, util.nspath_eval('gmd:name', self.namespaces)) + etree.SubElement(name, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link['name'] - desc = etree.SubElement(online2, util.nspath_eval('gmd:description', self.namespaces)) - etree.SubElement(desc, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link['description'] + if 'description' in link: + desc = etree.SubElement(online2, util.nspath_eval('gmd:description', self.namespaces)) + etree.SubElement(desc, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link['description'] + + if 'function' in link: + desc = etree.SubElement(online2, util.nspath_eval('gmd:function', self.namespaces)) + etree.SubElement(desc, util.nspath_eval('gco:CharacterString', self.namespaces)).text = link['function'] return node