From 1077a40bf1f276c694db92d3f360a1aafb881811 Mon Sep 17 00:00:00 2001 From: kthoden Date: Wed, 27 May 2020 12:57:13 +0200 Subject: [PATCH] Parent can be chapter element --- src/tei2imxml.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tei2imxml.py b/src/tei2imxml.py index 35eff6b..ef4f1ad 100755 --- a/src/tei2imxml.py +++ b/src/tei2imxml.py @@ -1527,8 +1527,11 @@ def add_bibliography_monograph(xml_tree, refs_for_bib_chapter): for eoa_pi in eoa_pis: if eoa_pi.text == "printbibliography": bibliography_parent = eoa_pi.getparent() - bibliography_parent.tag = "tagtobestripped" - bibliography_chapter = eoa_pi.xpath("ancestor-or-self::div1[1]")[0] + if bibliography_parent.tag == "div1": + bibliography_chapter = bibliography_parent + else: + bibliography_parent.tag = "tagtobestripped" + bibliography_chapter = eoa_pi.xpath("ancestor-or-self::div1[1]")[0] # print(bibliography_chapter)