Re: XSL transformation removing closing tag for empty
Presumably if the recipient can't handle an empty element tag that means it's expecting HTML rather than XML, so use <xsl:output method="html">.
The OP is using an AJAX call. AJAX usually means that XMLHttpRequest is used to receive XML from a server. It is possible to use the text content of the response, in which case HTML would suffice. But if the OP uses the returned XML as DOM object, the DOM object will be empty or null when the the output method on the server is set to HTML.
And if the OP is indeed using the DOM, (s)he can use the DOM to manipulate the result. I use AJAX daily and never have any problem with minimized tags, because I use the DOM directly and add the DOM to the HTML DOM of the page (in which case it doesn't matter at all how the element would be serialized).
I am guessing here: if the OP is using, for some reason, the serialized version of the response object of XMLHttpRequest, and tries to insert that with innerHTML for example, it might give well-known rendering problems to have certain tags in minimized form. A workaround is to add some content into the DIV, since the content is going to be replaced anyway. I.e.:
<div><!-- some comment node --></div>
Cheers, -- Abel Braaksma
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format