RE: [xsl] Preventing tags from collapsing

Subject: RE: [xsl] Preventing tags from collapsing
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Fri, 15 Apr 2005 09:49:02 +0100
> Or switch browser.
> A few weeks ago I spent a full day finding out that IE6 produces no
> output if it sees a collapsed script tag (self-contained
> <script /> is
> the correct wording I believe). Confusingly enough it does like
> selfcontained <meta /> and <link /> tags so that rules out total
> ignorance and makes not understanding <script /> a _bug_.

It's not a bug - it's because <meta> and <link> are defined as empty
elements in HTML and so the browser does not expect a closing tag.
<script> on the other hand is not defined as empty, therefore when you
have <script/> IE doesn't recognise that it's an empty element and looks
for a closing tag, effectively making the rest of the content the body
of the script.

The same applies to styling, for example: <div
style="font-weight:bold"/> everything following this div will be bold.

If you are using XSLT 1.0 you either have to use the HTML output method,
or be very careful in your templates to ensure you don't get empty
elements like this your output.

As has been said, if you are using Saxon your are better off moving to a
later version and using the XHTML with your existing 1.0 stylesheets (it
also allows to pick and choose the other great features of 2.0 to use).


Current Thread