From 4ae7afbf95201798fdd07394460e34477b8bd555 Mon Sep 17 00:00:00 2001 From: kthoden Date: Wed, 15 Jan 2020 18:19:53 +0100 Subject: [PATCH] Handle parts so they are recognized by next scripts --- src/tei2imxml.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tei2imxml.py b/src/tei2imxml.py index 2d877dc..88fa28b 100755 --- a/src/tei2imxml.py +++ b/src/tei2imxml.py @@ -614,6 +614,13 @@ def handle_refs_default(ref): else: logging.warning("Found a processing instruction without parent!") + eoa_parts = xml_tree.xpath("//t:div[@type='part']", namespaces=NS_MAP) + for part in eoa_parts: + part.tag = "div0" + xml_id = part.attrib["{http://www.w3.org/XML/1998/namespace}id"] + del part.attrib["{http://www.w3.org/XML/1998/namespace}id"] + part.set("id", xml_id) + eoa_chapters = xml_tree.xpath("//t:div[@type='chapter']", namespaces=NS_MAP) for chapter in eoa_chapters: chapter.tag = "div1"