[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: wierd textarea behaviour with xsl

Subject: RE: wierd textarea behaviour with xsl
From: Declan Brennan <dbrennan@xxxxxxxxxx>
Date: Tue, 12 Nov 2002 15:18:15 -0000
textarea 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.