Re: [xsl] empty textarea broken in IE6, mozilla

Subject: Re: [xsl] empty textarea broken in IE6, mozilla
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 14 Nov 2002 13:41:17 -0500
Stuart,

You could generate a comment in your result instead of a space:

<textarea name="comments" cols="50" rows="5" class="bodytext">
  <xsl:comment> x </xsl:comment>
</textarea>

Such a comment (or processing instruction) is a common workaround when targeting HTML or SGML systems that don't like XML empty-element syntax.

But since you didn't say why you need to trim the space I can't say if this is actually an improvement.

Cheers,
Wendell

At 01:27 PM 11/14/2002, you wrote:
I am a bit surprised that empty <textarea> inputs on forms really break the
current generation of browsers, both IE 6 and mozilla 1.
Here is my XSLT:

<!-- Comments -->
<tr valign="top" align="left">
  <td width="15%" bgcolor="#ffffff" class="bodytextbold">Comments:</td>
  <td colspan="3" bgcolor="#ffffff">
    <p>
      <textarea name="comments" cols="50" rows="5" class="bodytext">
      </textarea>
    </p>
  </td>
</tr>

What happens is that all the HTML on the page after the textarea is shown by
the browsers as the CONTENTS of the text area! (You have to see the bug to
believe it.)

It appears that the problem is that the XSL processor (Xalan-C) optimizes
the empty element as follows:
     <textarea name="comments" cols="50" rows="5" class="bodytext" />

The browsers absolutely choke on this.

Manually changing the generated HTML to include the </textarea> end tag
fixes the problem.

Is there a way to suppress this optimization of empty elements? My
<xsl:output> method is "html".

I solved the problem temporarily by adding a blank character text node:

      <textarea name="comments" cols="50" rows="5" class="bodytext">
      <xsl:text> </xsl:text>
      </textarea>

However, this is a temporary fix because it forces the <textarea> to include
the blank which I would have to trim later.


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread