xsl-list
[Top] [All Lists]

Re: [xsl] XSL transformation removing closing tag for empty div

2007-06-03 06:22:15
Michael Kay wrote:
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--