com.gargoylesoftware.htmlunit.javascript.host.xml.XMLSerializer ignores xsl:output
See original GitHub issueHi,
I notice that com.gargoylesoftware.htmlunit.javascript.host.xml.XMLSerializer
ignores any output options defined however it may simply be my understanding or my environment and others with a better understanding able to guide me to a solution or clarify my understanding.
I am running HtmlUnit
indirectly through a Google Web Toolkit (GWT) GWTTestCase
that uses HtmlUnit
internally… (so my ability to change to a different version of HtmlUnit
is more difficult, if needed). That aside how HtmlUnit
is instantiated should have little influence on the issue.
During my debugging I notice com.gargoylesoftware.htmlunit.javascript.host.xml.XSLTProcessor
is looking up a Xalan XSLTProcessor
that correctly contains the same output settings defined in the XSLT after instantiation and transformation to a Element
. However com.gargoylesoftware.htmlunit.javascript.host.xml.XMLSerializer
ignores the output settings and writes the string to a single un-indented line.
My XLST (additional settings taken from here)
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ',
xmlns:xalan="http://xml.apache.org/xalan" >
<xsl:output indent="yes" xalan:indent-amount="2" />
My usage from JS
var xlstProcessor = new XSLTProcessor(xslt);
var xmlResult = xlstProcessor.transformToDocument(xmlDocument);
new XMLSerializer().serializeToString(xmlResult);
When ran in a real browser this returns a formatted (indents and multi-line) string.
Any pointers or help very much appreciated.
With kind regards,
Mike
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Great will have a look at this tomorrow
Sorry for the missing comment here, this is implemented with the latest release. Please check and open a new issue if you still have problems with this.
Again sorry for missing this update.