Re: [xsl] Preventing tags from collapsing

Subject: Re: [xsl] Preventing tags from collapsing
From: ben senior <ben@xxxxxxxxxxxxx>
Date: Fri, 15 Apr 2005 10:14:47 +0200
Thanks Cas,

In our case it turns out that it is XML transforms happening long before XSL comes on the scene that are causing the minimisation.

Although, I suppose we could then use XSL to find nodes with no content, and then 'un-minimise' them by inserting some comments text. Hmm.. it's worth a go I suppose.

Ta,

Ben

Cas Tuyn wrote:

Ben,

I inserted an html comment:

<script ...><!--Leave this here to solve and IE bug--></script>

because I found the problem while using the Nvu 0.81 (X)HTML editor which insists on collapsing empty tags into self-contained tags. Because a few people still insist on using IE here, above tag will remind HTML coders to not remove it.

If you're doing XML to HTML via XSLT it is less likely that people will later hand-edit the HTML, so you can get away with just a space in the tag.

Cas


We have yet to find a way to stop tags containing no content from being collapsed :

e.g.

<script></script> is always output as <script/> or
<textarea></textarea> as <textarea/>

This is sending us barking as browsers do not treat the two different renditions equally.

Current Thread