Remove <relatedItem/>
elements that do not have children (i.e. only contain text) or do not have @target
attribute. If the parent element of <relatedItem/>
would be empty after removal, it will also be removed.
Before transformation:
<teiHeader>
<!-- ... -->
<biblFull>
<!-- ... -->
<notesStmt>
<note/>
<relatedItem>content</relatedItem>
</notesStmt>
</biblFull>
<!-- ... -->
</teiHeader>
After transformation:
<teiHeader>
<!-- ... -->
<biblFull>
<!-- ... -->
<notesStmt>
<note/>
</notesStmt>
</biblFull>
<!-- ... -->
</teiHeader>