SVGHMI: Better and less verbose SVG namespace handling in XSLT transform svghmi
authorEdouard Tisserant
Fri, 21 Feb 2020 16:15:33 +0100
branchsvghmi
changeset 2840 e588f25e6c74
parent 2839 f4dd234faa11
child 2841 7c6050cde9e3
SVGHMI: Better and less verbose SVG namespace handling in XSLT transform
svghmi/gen_index_xhtml.ysl2
--- a/svghmi/gen_index_xhtml.ysl2	Mon Feb 17 13:57:44 2020 +0100
+++ b/svghmi/gen_index_xhtml.ysl2	Fri Feb 21 16:15:33 2020 +0100
@@ -14,6 +14,8 @@
     with "mandatory","'no'";
 };
 
+in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template;
+
 istylesheet
             /* From Inkscape */
             xmlns:dc="http://purl.org/dc/elements/1.1/"
@@ -116,7 +118,7 @@
     /* replaces inkscape's height and width hints. forces fit */
     template "svg:svg/@width", mode="inline_svg";
     template "svg:svg/@height", mode="inline_svg";
-    template "svg:svg", mode="inline_svg" xsl:copy {
+    svgtmpl "svg:svg", mode="inline_svg" svg {
         attrib "preserveAspectRatio" > none
         attrib "height" > 100vh
         attrib "width" > 100vw
@@ -147,7 +149,9 @@
             apply "$indexed_hmitree", mode="testtree";
         }
         /**/
-        html xmlns="http://www.w3.org/1999/xhtml" {
+        html xmlns="http://www.w3.org/1999/xhtml"
+             xmlns:svg="http://www.w3.org/2000/svg"
+             xmlns:xlink="http://www.w3.org/1999/xlink" {
             head;
             body style="margin:0;overflow:hidden;" {
                 apply "svg:svg", mode="inline_svg";