class Metanorma::Generic::Converter
def empty_metadata_cleanup(ext)
Keep cleaning until no more elements are removed (recursive depth-first)
def empty_metadata_cleanup(ext) loop do removed_count = 0 ext.xpath(".//*").reverse_each do |element| element.children.empty? && element.attributes.empty? or next element.remove removed_count += 1 end removed_count.zero? and break # Stop when no elems removed this pass end end