diff --git a/mets_mods2teiHeader/api/mets.py b/mets_mods2teiHeader/api/mets.py index dbf7f83..f6b370a 100644 --- a/mets_mods2teiHeader/api/mets.py +++ b/mets_mods2teiHeader/api/mets.py @@ -56,6 +56,7 @@ def __init__(self): self.places = None self.dates = None self.publishers = None + self.edition = None self.digital_origin = None self.owner_digital = None self.license = None @@ -156,6 +157,14 @@ def __spur(self): for publisher in self.tree.xpath("//mets:dmdSec[1]//mods:mods/mods:originInfo[1]/mods:publisher", namespaces=ns): self.publishers.append(publisher.text) + # + # edition of the manuscript + edition = self.tree.xpath("//mets:dmdSec[1]//mods:mods/mods:originInfo[1]/mods:edition", namespaces=ns) + if edition: + self.edition = edition[0].text + else: + self.edition = "" + # # digital_origin for digital_origin in self.tree.xpath("//mets:dmdSec[1]//mods:mods/mods:physicalDescription[1]/mods:digitalOrigin", namespaces=ns): @@ -280,6 +289,12 @@ def get_publishers(self): """ return self.publishers + def get_edition(self): + """ + Return the edition of the source manuscript + """ + return self.edition + def has_digital_origin(self): """ Element "digitalOrigin" present? diff --git a/mets_mods2teiHeader/api/tei.py b/mets_mods2teiHeader/api/tei.py index 4f7a8b8..99cd7e7 100644 --- a/mets_mods2teiHeader/api/tei.py +++ b/mets_mods2teiHeader/api/tei.py @@ -111,6 +111,15 @@ def add_publisher(self, publisher): name.text = publisher publication_stmt.insert(0, publisher_node) + def add_source_edition(self, manuscript_edition): + """ + Adds an edition statement with details on the source manuscript. + """ + bibl_full = self.tree.xpath('//tei:fileDesc/tei:sourceDesc/tei:biblFull', namespaces=ns)[0] + edition_stmt = etree.SubElement(bibl_full, "editionStmt") + edition = etree.SubElement(edition_stmt, "edition") + edition.text = manuscript_edition + def add_digital_edition(self, digital_edition): """ Adds an edition statement with details on the digital edition. diff --git a/mets_mods2teiHeader/data/tei_skeleton.xml b/mets_mods2teiHeader/data/tei_skeleton.xml index 14ce83e..430c3d4 100644 --- a/mets_mods2teiHeader/data/tei_skeleton.xml +++ b/mets_mods2teiHeader/data/tei_skeleton.xml @@ -15,9 +15,6 @@ [Haupttitel einer Monographie] - - - diff --git a/mets_mods2teiHeader/scripts/mets_mods2teiHeader.py b/mets_mods2teiHeader/scripts/mets_mods2teiHeader.py index 4b8a10c..34dbfec 100644 --- a/mets_mods2teiHeader/scripts/mets_mods2teiHeader.py +++ b/mets_mods2teiHeader/scripts/mets_mods2teiHeader.py @@ -56,6 +56,10 @@ def cli(mets): for publisher in mets.get_publishers(): tei.add_publisher(publisher) + # manuscript edition + if mets.get_edition(): + tei.add_source_edition(mets.get_edition()) + # digital edition if mets.has_digital_origin(): tei.add_digital_edition(mets.get_digital_origin())