Skip to content

Commit

Permalink
use the last parent, not the first one, for working out the prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
goose-life committed Dec 12, 2024
1 parent c04d331 commit a4ca71a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bluebell/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def rewrite_all_attachment_work_components(self, xml):
ns = xml.nsmap[None]
for doc in xml.xpath('//a:attachment/a:doc', namespaces={'a': ns}):
parent = doc.getparent().xpath('ancestor::a:attachment/a:doc/a:meta/a:identification/a:FRBRWork/a:FRBRthis', namespaces={'a': ns})
prefix = FrbrUri.parse(parent[0].attrib['value']).work_component + '/' if parent else ''
prefix = FrbrUri.parse(parent[-1].attrib['value']).work_component + '/' if parent else ''
name = doc.attrib['name']
# e.g. schedule_1/schedule, schedule_2/appendix, etc.
prefix_name = f'{prefix}{name}'
Expand Down

0 comments on commit a4ca71a

Please sign in to comment.