diff --git a/se/easy_xml.py b/se/easy_xml.py index b2d8680e..c6d3eb37 100644 --- a/se/easy_xml.py +++ b/se/easy_xml.py @@ -234,7 +234,9 @@ def _replace_shorthand_namespaces(self, value:str) -> str: epub:type -> {http://www.idpf.org/2007/ops}type """ - if self.namespaces: + # The in check is redundant with the regex but is far more efficient + # when the value is un-namespaced + if ':' in value and self.namespaces: value = regex.sub(r"^(\L):", lambda m: f"{{{self.namespaces[m[1]]}}}", value, ns=self.namespaces.keys()) return value