monograph postprocessor

Module which defines postprocessing for monograph publications.

marcxml2mods.mods_postprocessor.monograph.add_xml_declaration(fn)

Decorator to add header with XML version declaration to output from FN.

marcxml2mods.mods_postprocessor.monograph.get_mods_tag(dom)

Find and return HTMLElement with <mods:mods> tag from the dom.

marcxml2mods.mods_postprocessor.monograph.add_missing_xml_attributes(dom, volume_counter=0)

Add xmlns and ID attributes to <mods:mods> tag.

Parameters:
  • dom (HTMLElement) – DOM containing whole document.
  • volume_counter (int, default 0) – ID of volume.
marcxml2mods.mods_postprocessor.monograph.fix_invalid_type_parameter(dom)

“Make sure that <mods:placeTerm> has type="code" attribute.

marcxml2mods.mods_postprocessor.monograph.add_uuid(dom, uuid)

Add <mods:identifier> with uuid.

marcxml2mods.mods_postprocessor.monograph.add_marccountry_tag(dom)

Add <mods:placeTerm> tag with proper content.

marcxml2mods.mods_postprocessor.monograph.add_genre(dom)

Add <mods:genre> with electronic volume content into <mods:originInfo.

marcxml2mods.mods_postprocessor.monograph.remove_hairs_from_tags(dom)

Use remove_hairs() to some of the tags:

  • mods:title
  • mods:placeTerm
marcxml2mods.mods_postprocessor.monograph.fix_issuance(dom)

Fix <mods:issuance> for monographic tags from monographic to single_unit.

marcxml2mods.mods_postprocessor.monograph.fix_location_tag(dom)

Repair the <mods:location> tag (the XSLT template returns things related to paper books, not electronic documents).

Remove <mods:relatedItem> tag in case that there is only <mods:location> subtag.

marcxml2mods.mods_postprocessor.monograph.fix_missing_electronic_locator_tag(dom, url)

In case that MODS contains no URL and the location is wrong (physical), add url from url parameter.

marcxml2mods.mods_postprocessor.monograph.fix_missing_lang_tags(marc_xml, dom)

If the lang tags are missing, add them to the MODS. Lang tags are parsed from marc_xml.

marcxml2mods.mods_postprocessor.monograph.postprocess_monograph(*args, **kwargs)

Fix bugs in mods produced by XSLT template.

Parameters:
  • marc_xml (str) – Original Aleph record.
  • mods (str) – XML string generated by XSLT template.
  • uuid (str) – UUID of the package.
  • counter (int) – Number of record, is added to XML headers.
  • url (str) – URL of the publication (public or not).
Returns:

Updated XML.

Return type:

str