Re: [xsl] Closing element required instead of self closing

Subject: Re: [xsl] Closing element required instead of self closing
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 15 Jul 2008 10:07:58 +0100
2008/7/15 Michael Kay <mike@xxxxxxxxxxxx>:
>> I need closing element when I match a specific element,
>> Instead of getting self closing.
> Why?
> If the receiving application conforms to XML standards, then it will accept
> either.

But if the receiving application is a browser like IE and you're
trying to generate XHTML then you do need worry about minimization.

If you're using Saxon then just use the XHTML output method.  If
you're stuck with 1.0 then output a comment:

<script src="..."><xsl:comment/></script>

or if you have a load of script imports in your head block you can do:

<head xml:space="preserve">
  <script src="..."> </script>
  <script src="...2"> </script>

but both techniques are a bit rubbish.  But it gets worse when you
have something like:

<div class="bold"/>

Everything after that will be bold, so you always have to code your
transform thinking about whether that ouput is a possibility.

I've always thought its a bit of an artificial restriction to force
the user into these hacks when a simple proprietary serializer switch
could disable tag minimization - the argument works both ways... if it
shouldn't matter if the tag is minimized, then it's no problem if it

Anyway, this is an old problem which might not be the case with the
latest browsers... and of course it's not an issue at all if you use
the XHTML output method.

Andrew Welch

Current Thread