docbook: fixed the xslt output (remove DOCTYPE)
authorFredrik Unger <fredrik.unger@openchip.com>
Wed, 4 Mar 2026 07:10:26 +0000 (08:10 +0100)
committerFredrik Unger <fredrik.unger@openchip.com>
Wed, 4 Mar 2026 07:10:26 +0000 (08:10 +0100)
The doctype caused errors in the parsing of the html,
as it apears inside the template.
Adjusted this and pretty printed the string for readability

treecutter/docbook.py

index 1e39a9867ca7970a746d66441f8503bf7848b05d..ee310549c1713ae67ad73583e0e5118f7cc091fe 100644 (file)
@@ -240,7 +240,13 @@ class Docbook:
 
     def xslt(self, transform):
         """XSLT transform"""
-        return etree.tostring(transform(self._doc))
+        transformed = transform(self._doc)
+        transformed_str = etree.tostring(transformed.getroot(),
+                                         encoding="unicode",
+                                         method="xml", doctype=None,
+                                         pretty_print=True,
+                                         xml_declaration=False))
+        return transformed_str
 
     def clean(self):
         """cleaning xml"""