I have a source XHTML document with elements in multiple namespaces that I am transforming into an HTML document (obviously with no namespaces). In my XSL templates I only match elements in the XHTML namespace to remove non-HTML-compatible elements from the result tree. However, in the output, while those elements are gone, the whitespace I used to indent them remains—i.e., lines of irrelevant CR/LFs and tabs.
For example, if this is my input:
<div id="container">
<svg:svg>
<svg:foreignObject>
<img />
</svg:foreignObject>
</svg:svg>
</div>
After applying the transformation, this will be the output:
<div id="container">
<img />
</div>
While my desired output is this:
<div id="container">
<img />
</div>
This happens using both TransforMiiX (attaching the stylesheet locally in Firefox) and libxslt (attaching the stylesheet server-side with PHP), so I know it's probably the result of some XSL parameter not getting set, but I've tried playing with <xsl:output indent="yes|no" />
, xml:space="default|preserve"
, <xsl:strip-space elements="foo bar|*" />
, all to no avail.
This will be implemented server-side so if there's no way to do it in raw XSL but there is a way to do it in PHP I'll accept that.
I know this is not a namespace issue since I get the same result if I remove ANY element.