xsl-list
[Top] [All Lists]

RE: wierd textarea behaviour with xsl

2002-11-12 08:44:18
It looks to me as if you are using the XML output method when you should
be using HTML.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Declan Brennan
Sent: 12 November 2002 15:18
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] wierd textarea behaviour with xsl


Thanks but that didn't fix it fully.

The problem lies in the fact that the <textarea> tag is not 
being closed 
properly if there is no value in the xsl select (if there is, 
it works ok now).

So if there is - the html source looks like :
<textarea rows="5" cols="40" name="comment" 
class="textbox">Dum de dum.</textarea>

If there isn't, the html source looks like, (note the lack of 
closing tag) : <textarea rows="5" cols="40" name="comment" 
class="textbox"/>

So to try and force a value into the box I used an xsl choose. 

<textarea rows="5" cols="40" name="comment" class="textbox">
      <xsl:choose>
              <xsl:when test="(./currentStatus/comment)">
                      <xsl:choose>
                              <xsl:when 
test="./currentStatus/comment !=
''">
                                      <xsl:value-of
select="./currentStatus/comment"/>
                              </xsl:when>
                              <xsl:otherwise>
                                      No comments.
                              </xsl:otherwise>
                      </xsl:choose>
              </xsl:when>
      </xsl:choose>
</textarea>

This has fixed it. Man, what a verbose way of having to 
populate a comment box.

If I remove the text between the otherwise tags, it goes back 
to not closing the <textarea> object properly. Anyone know a 
better way of doing this, as I'd prefer to keep the textarea 
empty if there is no value in the xml?

Thanks,

Declan

This is wierd. My xsl code is simple :

<TR>
  <TD class="h4">Reason</TD>
  <TD>
    <textarea rows="5" cols="40"  name="comment" class="textbox"
        value="{./currentStatus/comment}" />
  </TD>
</TR>
[snip]
But what is displayed is a textbox that contains 
</TD></TR></table><br/><TABLE and all the rest of the html for the 
page till the </html> tag.

What the heck is going wrong? I can't see it. Please help.

Outputing something that is not HTML; the textarea element of 
HTML does not have a value attribute, instead use

  <textarea rows="5" cols="40"  name="comment" class="textbox">
    <xsl:value-of select="./currentStatus/comment" />
  </textarea>



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



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