-
-
Notifications
You must be signed in to change notification settings - Fork 184
Description
Hi,
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