Hi Ilya,
Yes, you are correct. If you have a processor that supports the html
method (xslt 1.0) or the xhtml method (xslt 2.0), the processor will
output tags that optionally have content (as per the HTML DTD) as
<tag></tag> when empty, instead of <tag /> (see
http://www.w3.org/TR/xslt-xquery-serialization/#XHTMLEMPTY for details).
That is why <script src="bla.js"></script> must be written like this,
instead of the more sensible <script />, but then IE stops rendering.
Many people bang their head against the wall with this, particularly
because it is often not apparent where the behavior comes from.
(the opposite is also true: <br /> should not be written as <br></br>
because, you guessed it right, IE cannot handle it well)
Because you seem to try to create XHTML from an XSLT 1.0 processor
you've to manually make sure that the tags keep their closing tags. A
non-breaking space is not such a good solution, I think, because it may
influence the rendering results. Rather, you should choose the comment
approach:
<xsl:template match="somenode">
<div><xsl:comment>i am empty</xsl:comment></div>
<xsl:template>
This will successfully suppress the erroneous behavior of IE. You may
want to use a pipeline, where you re-apply a stylesheet that only adds
comments to a list of predefined nodes, this will eliminate the need of
checking each and every node in you stylesheet.
Cheers,
-- Abel Braaksma
Ilya Sterin wrote:
Everyone, thanks for the responses, they all helped. Andrew, you're
correct, after inspecting the html output, evidently IE is not as
forgiving as FF when it comes to certain ridiculous details. We were
using template divs which were self closing divs as well as self
closing textarea inputs. This is not supported by IE when not using
xhtml doctype I guess. The xhtml doctype breaks various things in FF.
The processor also changed empty div tags to self closing div tags
and did the same with any other element, so we had to insert a
non-breaking space in divs and textarea elements. IE stops parsing
when it gets to an erroneous element (well, one it considers
erroneous) and though that element is of course not available as a
part of the rendered DOM.
Thanks again to everyone.
Ilya
--~------------------------------------------------------------------
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>
--~--