Closed Bug 88198 Opened 23 years ago Closed 23 years ago

XSLT seems to ignore default <textarea> values

Categories

(Core :: XSLT, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.8

People

(Reporter: slaven.rezic, Assigned: peterv)

References

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.1) Gecko/20010607
BuildID:    2001060703

I'm trying to put default text in a <textarea> tag. This
seems to be ignored by the XSLT pattern. However, it works
if I'm using another XSLT transformer (e.g. Sablotron 0.6).


Reproducible: Always
Steps to Reproduce:
Here's bla.xsl:

<xsl:stylesheet version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns:spec='http://www.onlineoffice.de/'
         >

 <xsl:output method="html" />

 <xsl:template match="spec:form">
  <form name="{@name}" action="{@action}">
   <xsl:apply-templates/>
  </form>
 </xsl:template>

 <xsl:template match="spec:magicform">
  <form name="{@name}" action="{@action}">
   <table>
    <xsl:if test="@tableBorder"><xsl:attribute name="border"><xsl:value-of
select="@tableBorder" /></xsl:attribute></xsl:if>
    <xsl:if test="@tableCellspacing"><xsl:attribute
name="cellspacing"><xsl:value-of select="@tableCellspacing"
/></xsl:attribute></xsl:if>
    <xsl:if test="@tableCellpadding"><xsl:attribute
name="cellpadding"><xsl:value-of select="@tableCellpadding"
/></xsl:attribute></xsl:if>

    <xsl:apply-templates/>

    <tr>
     <td colspan="2">
      <input type="submit" value="OK" />
      <input type="button" value="Abbrechen" onclick="history.back(1)" />
     </td>
    </tr>
   </table>
  </form>
 </xsl:template>

 <xsl:template match="spec:form/spec:input" name="specinput">
  <xsl:choose>
   <xsl:when test="@displaytype='textarea'">
    <textarea name="{@name}">
     <xsl:value-of select="@default" />
     <xsl:value-of select="text()" />
    </textarea>
   </xsl:when>
   <xsl:otherwise>
    <input name="{@name}">
     <xsl:if test="@default">
      <xsl:attribute name="value"><xsl:value-of select="@default" /></xsl:attribute>
     </xsl:if>
     <xsl:choose>
      <xsl:when test="@displaytype">
       <xsl:attribute name="type"><xsl:value-of select="@displaytype"
/></xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
       <xsl:attribute name="type">text</xsl:attribute>
      </xsl:otherwise>
     </xsl:choose>
    </input>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

 <xsl:template match="spec:magicform/spec:input">
  <tr><td><xsl:value-of select="@caption" />: <xsl:if
test="@necessity='required'"><sup>*</sup></xsl:if>
  </td><td>
   <xsl:call-template name="specinput" />
  </td></tr>
 </xsl:template>

 <xsl:template match="spec:magicform/spec:group">
  <tr><td>
   <xsl:call-template name="groupcaptions" />
  </td><td>
   <xsl:call-template name="groupinputs" />
  </td></tr>
 </xsl:template>

 <xsl:template name="groupcaptions">
 </xsl:template>

 <xsl:template name="groupinputs">
 </xsl:template>

 <xsl:template match="*">
  <xsl:copy>
   <xsl:apply-templates/>
  </xsl:copy>
 </xsl:template>

</xsl:stylesheet>
-------------------------------------------------------------------
And here's bla.xml

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet href="bla.xsl" type="text/xsl"?>

<html xmlns:spec='http://www.onlineoffice.de/'>
 <head>
  <title>Test</title>
 </head>
 <body>
  <spec:magicform name="test" action="bla.cgi" tableBorder="0" tableCellspacing="5">
   <spec:input name="name2" caption="Emission" type="string"
displaytype="textarea" necessity="required">bla blubber foo</spec:input>
   <spec:input name="name23" caption="Emission" type="string"
displaytype="textarea" necessity="optional" default="bla blubber foo" />
   <spec:input name="name" caption="Emission" type="string" displaytype="text"
necessity="required" />
   <spec:input name="wpn" caption="WP-Nummer WKN" type="wkn"
necessity="required" default="DE ISIN1234567890"/>
   <spec:group>
    <spec:input name="plz" caption="Postleitzahl" type="zip" necessity="required" />
    <spec:input name="ort" caption="Ort" type="string" necessity="required" />
   </spec:group>
  </spec:magicform>
 </body>
</html>
--------------------------------------------------------------------




Actual Results:  There should be some text in the textarea, but there isn't.


Expected Results:  Something like this output:

<?xml-stylesheet href="bla.xsl" type="text/xsl"><html
xmlns:spec="http://www.onlineoffice.de/">
 <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Test</title>
 </head>
 <body>
  <form name="test" action="bla.cgi"><table border="0" cellspacing="5">
   <tr><td>Emission: <sup>*</sup></td><td><textarea name="name2">bla blubber
foo</textarea></td></tr>
   <tr><td>Emission: </td><td><textarea name="name23">bla blubber
foo</textarea></td></tr>
   <tr><td>Emission: <sup>*</sup></td><td><input name="name" type="text"></td></tr>
   <tr><td>WP-Nummer WKN: <sup>*</sup></td><td><input name="wpn" value="DE
ISIN1234567890" type="text"></td></tr>
   <tr><td></td><td></td></tr>
  <tr><td colspan="2"><input type="submit" value="OK"><input type="button"
value="Abbrechen" onclick="history.back(1)"></td></tr></table></form>
 </body>
</html>
Confirming. This is due to the textarea in mozilla not being tied to its text
node child.
The html output puts the default value into the value and defaultvalue 
attributes, and empties the text node child.
In XSLT, we generate the textarea, and then append it's textnode. (which are
XHTML elements for us).
brade, which of the flock of textarea attributes vs. text node child bugs is
this? 33014, 17003? Or any other? I guess this is a dupe, but which bug?

Axel

ps: slaven, if you file bugs on XSLT, please make minimal testcases (this one
was easy enough, 'cause the error is obvious, and there are bugs on textarea).
Don't paste the files here, but attach them.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows NT → All
Hardware: PC → All
I'm guessing here (since I'm not familiar with xslt)... I'd guess 17003 or one of 
its related bugs (50418, 58089).
Priority: -- → P5
I can fix this.
Assignee: kvisco → peterv
Priority: P5 → P1
Target Milestone: --- → mozilla0.9.4
Status: NEW → ASSIGNED
Blocks: 96647
No longer blocks: 96647
Depends on: 96647
Moving out :(.
Target Milestone: mozilla0.9.4 → mozilla0.9.5
The fix for this bug will be in bug 96647.
All these missed the bus/train/plane/boat/whatever. Sad.
Target Milestone: mozilla0.9.5 → mozilla0.9.6
if my fix for bug 17003 goes in we won't have to do any special hacking to get 
textareas to work in XSLT
Depends on: 17003
Target Milestone: mozilla0.9.6 → mozilla0.9.7
The patch for 96647 is nearly done, but it's a bit big and we need time for
reviews, unless something serious comes up this should land early in 0.9.7.
Target Milestone: mozilla0.9.7 → mozilla0.9.8
this should be fixed with the fix for bug 17003
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
No longer depends on: 96647
Resolution: --- → FIXED
we didn't verify for a long time.
I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.