Re: [xsl] Preventing tags from collapsing

Subject: Re: [xsl] Preventing tags from collapsing
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Thu, 14 Apr 2005 14:25:40 +0100
----- Original Message ----- From: "ben senior" <ben@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, April 14, 2005 2:11 PM
Subject: [xsl] Preventing tags from collapsing

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


<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.

Does anybody have any suggestion?



Sounds like you're trying to output xhtml, if xsl:output method is set to html this shouldn't happen. As the most widely used browser, for better or for worse this is still IE, doesn't support xhtml you're fighting a losing battle. Unless you are targetting an audience where the browser can be specified you'll need a workaround.
For script can you test if the content is empty and if so output a script comment (//this is a comment, for example)?
For textarea it depends, can you have a single space?


Current Thread