Why XSL code was dumped into TEXTAREA?

I am creating a FeedBack form, which loads the dynamic data from a XML file.

In my XSL file I created some <INPUT>s and one <TEXTAREA>. The contents of these fields will be from the XML files.

When I process these two files, all <INPUT> fields display the contents successfully except the <TEXTAREA> which dumps the code of XSL file into itself instead of ""(blank) defined in XML file.

Please advise what am I doing wrong here. Thank you very much.

Albert K.T.Tan

The following are the XML/XSL files: -

FeedBack.xml

-

<FeedBack>

<To>support@tandom.com</To>

<From>kttan</From>

<Subject>FeedBack - </Subject>

<Message></Message>

</FeedBack>

FeedBack.xsl

<?xml version="1.0" ?>

<xsl:stylesheet

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

version="1.0">

<xsl:template match="/">

<FORM ACTION="feedbackresult.jsp" METHOD="post">

<TABLE BORDER="0" CELLSPACING="3" CELLPADDING="5">

<TR ALIGN="left" VALIGN="middle">

<CAPTION><FONT size="+3" BGCOLOR="#CCCCCC"><B> FeedBack Form </B></FONT></CAPTION>

</TR>

<TBODY BGCOLOR="#CCCCCC">

<TR ALIGN="left" VALIGN="middle">

<TD>From : </TD>

<TD>

<input type="text" name="From" size="40" maxlength="40">

<xsl:attribute name="value">

<xsl:value-of select="FeedBack/From" />

</xsl:attribute>

</input>

</TD>

<!-- <TD><INPUT SIZE="40" MAXLENGTH="40"/></TD> -->

</TR>

<TR ALIGN="left" VALIGN="middle">

<TD>To : </TD>

<TD>

<input type="text" name="To" size="40" maxlength="40">

<xsl:attribute name="value">

<xsl:value-of select="FeedBack/To" />

</xsl:attribute>

</input>

</TD>

<!-- <TD><INPUT SIZE="40" MAXLENGTH="40"/></TD> -->

</TR>

<TR ALIGN="left" VALIGN="middle">

<TD>Subject : </TD>

<TD>

<input type="text" name="Subject" size="60" maxlength="60">

<xsl:attribute name="value">

<xsl:value-of select="FeedBack/Subject" />

</xsl:attribute>

</input>

</TD>

<!-- <TD><INPUT SIZE="60" MAXLENGTH="60"/></TD> -->

</TR>

<TR ALIGN="left" VALIGN="top">

<TD>Message : </TD>

<TD>

<TEXTAREA COLS="52" ROWS="15" name="Message">

<xsl:attribute name="value">

<xsl:value-of select="FeedBack/Message" />

</xsl:attribute>

[2946 byte] By [kttan] at [2007-9-26 2:18:37]
# 1

Hi,

I tried using the xml and xsl code snippet that you posted and it worked fine for me using Saxon from the command line. I dont see anything wrong in your code.

But one thing that you may consider is to remove the <xsl:attribute name="value"> within the TEXTAREA tags.

Usual representation of a Textarea is:

<TEXTAREA name="textarea" rows="15" cols="50">

Your text info goes here....

</TEXTAREA>

Textarea does not have a "value" attribute.

So simply change your code from

<TEXTAREA COLS="52" ROWS="15" name="Message">

<xsl:attribute name="value">

<xsl:value-of select="FeedBack/Message" />

</xsl:attribute>

</TEXTAREA>

to

<TEXTAREA COLS="52" ROWS="15" name="Message">

<xsl:value-of select="FeedBack/Message" />

</TEXTAREA>

Hope that helps.

Arun

arun78 at 2007-6-29 9:19:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

I have removed <xsl:attribute name="value"> but the result was the same as before... All objects after TEXTFIELD were not executed and the coding was dumped into TEXTFIELD. Strange!!!

If I remove TEXTFIELD then all objects will be displayed correctly.

BTW, I tested from the command line with both xalan_1_2_D01 and xalan-j_2_0_1 distributions.

I have not tried Saxon yet. Where can I download it?

Thanks for the help.

Albert K.T.Tan

kttan at 2007-6-29 9:19:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Saxon can be downloaded from here. http://users.iclway.co.uk/mhkay/saxon/
arun78 at 2007-6-29 9:19:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...