Subject: Weird whitespace appears in TEXTAREA, why?
Posted By: jacob Post Date: 11/10/2005 5:40:56 PM
Through an XSLT document I have added an HTML textarea to a form, which works, beside the fact that some whitespace charaters appear after the page is generated. Why can this be?

The textarea is put in a series of nested tables, and what I have found out through experiments is that for every new table I put it in 6 new whitespaces are added, odd right? Furthermore, I found that if I put a single character just outside the textarea (also nested within tables), then the whitespace is not there. Why? Is it some kind of bug? Solution?

I cannot recreate the error in a simple HTML document.

Thanks, Jacob.
Reply By: jacob Reply Date: 11/10/2005 5:53:16 PM
As an ugly work-around to the problem I found is this...
<textarea id="message" name="message" type="text" runat="server"></textarea>
<script language="javascript">    
    document.getElementById("message").innerText = "";
</script>
Well, it is not pretty, but it works. Still very interested in the reason and perhaps the correct solution.

Jacob.
Reply By: mhkay Reply Date: 11/10/2005 6:27:06 PM
Unwanted whitespace in your result document can come from three sources:

(a) there was whitespace in the source document which you copied to the result

(b) there was whitespace in the stylesheet which you copied to the result

(c) the whitespace was added by the serializer when indenting the result document if you specified indent=yes (which is the default for HTML)

Without more information it's impossible to tell which of these was the cause in your case.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply By: jacob Reply Date: 11/10/2005 7:25:25 PM
Thanks again, Michael, and naturally you are right.

The 3rd whitespace source you mentioned (c) fit quite well on the description of the problem in the first place; i.e. as the tables get more and more nested, more whitespace is added.

I swiched the indent to no and there was no more whitespace in un-wanted places. Is it a bug?

Thanks, Jacob.

Go to topic 34878

Return to index page 438
Return to index page 437
Return to index page 436
Return to index page 435
Return to index page 434
Return to index page 433
Return to index page 432
Return to index page 431
Return to index page 430
Return to index page 429