Method: IsoDoc::Metadata#agency

Defined in:
lib/isodoc/metadata.rb

#agency(xml) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/isodoc/metadata.rb', line 94

def agency(xml)
  agency = ""
  xml.xpath(ns("//bibdata/contributor[xmlns:role/@type = 'publisher']/"\
               "organization")).each do |org|
    name = org&.at(ns("./name"))&.text
    abbrev = org&.at(ns("./abbreviation"))&.text
    agency1 = abbrev || name
    agency = iso?(org) ?  "ISO/#{agency}" : "#{agency}#{agency1}/"
  end
  set(:agency, agency.sub(%r{/$}, ""))
end