You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by co...@apache.org on 2003/07/06 00:53:33 UTC

cvs commit: cocoon-2.1/src/blocks/woody/samples/xsl/html woody-default.xsl

coliver     2003/07/05 15:53:33

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        Button.java Field.java Form.java
               src/blocks/woody/samples sitemap.xmap welcome.xml
               src/blocks/woody/samples/xsl/html woody-default.xsl
  Added:       src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript
                        ScriptableWidget.java woody.js
               src/blocks/woody/samples/flow woody_flow_example.js
               src/blocks/woody/samples/forms form1_template.xsp
  Log:
  First try at flowscript support for Woody
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/ScriptableWidget.java
  
  Index: ScriptableWidget.java
  ===================================================================
  /*
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.woody.flow.javascript;
  import org.mozilla.javascript.*;
  import org.apache.cocoon.woody.formmodel.Widget;
  import org.apache.cocoon.woody.formmodel.Field;
  import org.apache.cocoon.woody.formmodel.Repeater;
  import org.apache.cocoon.woody.formmodel.BooleanField;
  import org.apache.cocoon.woody.formmodel.AggregateField;
  import org.apache.cocoon.woody.formmodel.MultiValueField;
  
  public class ScriptableWidget extends ScriptableObject {
  
      Widget delegate;
  
      public String getClassName() {
          return "Widget";
      }
  
      public ScriptableWidget() {
      }
  
      public ScriptableWidget(Object widget) {
          this.delegate = (Widget)unwrap(widget);
      }
  
      private Object unwrap(Object obj) {
          if (obj == Undefined.instance) {
              return null;
          }
          if (obj instanceof Wrapper) {
              return ((Wrapper)obj).unwrap();
          }
          return obj;
      }
  
      private ScriptableWidget wrap(Widget w) {
          ScriptableWidget result = new ScriptableWidget(w);
          result.setPrototype(getClassPrototype(this, "Widget"));
          result.setParentScope(getParentScope());
          return result;
      }
  
      public boolean has(String id, Scriptable start) {
          if (delegate instanceof Repeater) {
              if (id.equals("length")) {
                  return true;
              }
          } else if (delegate != null) {
              Widget sub = delegate.getWidget(id);
              if (sub != null) {
                  return true;
              }
          } 
          return super.has(id, start);
      }
  
      public boolean has(int index, Scriptable start) {
          if (delegate instanceof Repeater) {
              Repeater repeater = (Repeater)delegate;
              return index >= 0 && index < repeater.getSize();
          }
          return super.has(index, start);
      }
  
      public Object get(String id, Scriptable start) {
          if (delegate instanceof Repeater) {
              if (id.equals("length")) {
                  Repeater repeater = (Repeater)delegate;
                  return new Integer(repeater.getSize());
              }
          } else if (delegate != null) {
              Widget sub = delegate.getWidget(id);
              if (sub != null) {
                  if (sub instanceof Field ||
                      sub instanceof BooleanField ||
                      sub instanceof AggregateField) {
                      return sub.getValue();
                  }
                  return wrap(sub);
              }
          }
          return super.get(id, start);
      }
  
      public Object get(int index, Scriptable start) {
          if (delegate instanceof Repeater) {
              Repeater repeater = (Repeater)delegate;
              if (index >= 0) {
                  while (index >= repeater.getSize()) {
                      repeater.addRow();
                  }
                  return wrap(repeater.getRow(index));
              }
          }
          return super.get(index, start);
      }
  
      public void delete(String id) {
          super.delete(id);
      }
  
      public void delete(int index) {
          if (delegate instanceof Repeater) {
              Repeater repeater = (Repeater)delegate;
              if (index >= 0 && index < repeater.getSize()) {
                  repeater.removeRow(index);
                  return;
              }
          } else if (delegate instanceof MultiValueField) {
              MultiValueField field = (MultiValueField)delegate;
              Object[] values = (Object[])field.getValue();
              if (values != null && values.length > index) {
                  Object[] newValues = new Object[values.length-1];
                  int i;
                  for (i = 0; i < index; i++) {
                      newValues[i] = values[i];
                  }
                  i++;
                  for (;i < values.length;i++) {
                      newValues[i-1] = values[i];
                  }
                  field.setValues(newValues);
              }
              return;
          }
          super.delete(index);
      }
  
      public void put(String id, Scriptable start, Object value) {
          if (delegate instanceof Repeater) {
              if (id.equals("length")) {
                  int len = (int)Context.toNumber(value);
                  Repeater repeater = (Repeater)delegate;
                  int size = repeater.getSize();
                  if (size > len) {
                      while (repeater.getSize() > len) {
                          repeater.removeRow(repeater.getSize() -1);
                      }
                  } else {
                      for (int i = size; i < len; ++i) {
                          repeater.addRow();
                      }
                  }
              }
          } else if (delegate != null) {
              Widget sub = delegate.getWidget(id);
              if (sub instanceof Field) {
                  Field field = (Field)sub;
                  value = unwrap(value);
                  if (value instanceof Double) {
                      // make woody accept a JS Number
                      Class typeClass = 
                          field.getFieldDefinition().getDatatype().getTypeClass();
                      if (typeClass == long.class || typeClass == Long.class) {
                          value = new Long(((Number)value).longValue());
                      } else if (typeClass == int.class || typeClass == Integer.class) {
                          value = new Integer(((Number)value).intValue());
                      } else if (typeClass == float.class || typeClass == Float.class) {
                          value = new Float(((Number)value).floatValue());
                      } else if (typeClass == short.class || typeClass == Short.class) {
                          value = new Short(((Number)value).shortValue());
                      } 
                  } 
                  field.setValue(value);
                  return;
              } else if (sub instanceof BooleanField) {
                  BooleanField field = (BooleanField)sub;
                  value = unwrap(value);
                  field.setValue(value);
              } else if (sub instanceof Repeater) {
                  Repeater repeater = (Repeater)sub;
                  if (value instanceof NativeArray) {
                      NativeArray arr = (NativeArray)value;
                      Object length = getProperty(arr, "length");
                      int len = ((Number)length).intValue();
                      for (int i = repeater.getSize(); i >= len; --i) {
                          repeater.removeRow(i);
                      }
                      for (int i = 0; i < len; i++) {
                          Object elemValue = getProperty(arr, i);
                          if (elemValue instanceof Scriptable) {
                              Scriptable s = (Scriptable)elemValue;
                              Object[] ids = s.getIds();
                              ScriptableWidget wid = wrap(repeater.getRow(i));
                              for (int j = 0; j < ids.length; j++) {
                                  String idStr = ids[j].toString();
                                  wid.put(idStr, wid, getProperty(s, idStr));
                              }
                          }
                      }
                      return;
                  }
              } else if (sub instanceof MultiValueField) {
                  MultiValueField field = (MultiValueField)sub;
                  Object[] values = null;
                  if (value instanceof NativeArray) {
                      NativeArray arr = (NativeArray)value;
                      Object length = getProperty(arr, "length");
                      int len = ((Number)length).intValue();
                      values = new Object[len];
                      for (int i = 0; i < len; i++) {
                          Object elemValue = getProperty(arr, i);
                          values[i] = unwrap(elemValue);
                      }
                  } else if (value instanceof Object[]) {
                      values = (Object[])value;
                  }
                  field.setValues(values);
              } else {
                  if (value instanceof Scriptable) {
                      Scriptable s = (Scriptable)value;
                      Object[] ids = s.getIds();
                      ScriptableWidget wid = wrap(sub);
                      for (int j = 0; j < ids.length; j++) {
                          String idStr = ids[j].toString();
                          wid.put(idStr, wid, getProperty(s, idStr));
                      }
                      return;
                  }
              }
          }
          super.put(id, start, value);
      }
  
      public String jsGet_id() {
          return delegate.getId();
      }
  
      public Scriptable jsGet_parent() {
          if (delegate != null) {
              return wrap(delegate.getParent());
          }
          return Undefined.instance;
      }
  
      public boolean jsFunction_equals(Object other) {
          if (other instanceof ScriptableWidget) {
              ScriptableWidget otherWidget = (ScriptableWidget)other;
              return delegate.equals(otherWidget.delegate);
          }
          return false;
      }
  
      public void jsFunction_remove(int index) {
          delete(index);
      }
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/woody.js
  
  Index: woody.js
  ===================================================================
  defineClass("org.apache.cocoon.woody.flow.javascript.ScriptableWidget");
  
  function Form(formDef, attrName) {
    var formMgr = cocoon.componentManager.lookup(Packages.org.apache.cocoon.woody.FormManager.ROLE);
    try {
      var resolver = cocoon.environment;
      var src = resolver.resolveURI(formDef);
      this.form = formMgr.createForm(src);
      this.formWidget = new Widget(this.form);
      this.attrName = attrName;
      this.lastWebContinuation = null;
      this.rootContinuation = null;
    } finally {
      cocoon.componentManager.release(formMgr);
    }
  }
  
  Form.prototype.start = function(lastWebCont, timeToLive) {
      var result = this._start(lastWebCont, timeToLive);
      // 
      // _start() will return an Object when it's called
      // the first time. However, when its Continuation is invoked it
      // will return a WebContinuation instead. In the latter case
      // we're going back to the previous page: so 
      // clear the current page's violations before showing the previous page.
      // Without this, violations from the current page will
      // incorrectly be displayed on the previous page.
      if (result instanceof WebContinuation) {
          return result;
      }
      return result.kont;
  } 
  
  Form.prototype._start = function(lastWebCont, timeToLive) {
      var k = new Continuation();
      var kont = new WebContinuation(cocoon, k, 
                                     lastWebCont, timeToLive);
      if (this.rootContinuation == null) {
          this.rootContinuation = kont;
      }
      return {kont: kont};
  } 
  
  Form.prototype.getModel = function() {
    return this.formWidget;
  }
  
  Form.prototype.show = function(uri, validator) {
      var lastWebCont = this.lastWebContinuation;
      // create a continuation, the invocation of which will resend
      // the page: this is used to implement <xf:submit continuation="back">
      var wk = this.start(lastWebCont);
      while (true) {
          if (cocoon.request == null) {
              // this continuation has been invalidated
              this.dead = true;
              handleInvalidContinuation();
              suicide();
          }
          var thisWebCont = this._show(uri, wk);
          // _sendView creates a continuation, the invocation of which
          // will return right here: it is used to implement 
          // <xf:submit continuation="forward">
          if (this.dead ||  cocoon.request == null) {
              // this continuation has been invalidated
              handleInvalidContinuation();
              suicide();
          }
  	var formContext = 
  	  new Packages.org.apache.cocoon.woody.FormContext(cocoon.request, 
  							   java.util.Locale.US);
  	var e = cocoon.request.getParameterNames();
  	while (e.hasMoreElements()) {
  	  var paramName = e.nextElement();
  	  print(paramName + "="+cocoon.request.get(paramName));
  	}
  	cocoon.request.setAttribute(this.attrName, this.form);
          var finished = this.form.process(formContext);
  	print("finished="+finished);
  	var evt = formContext.getActionEvent();
  	if (evt != null) {
  	  this.submitId = String(evt.getActionCommand());
  	} else {
  	  this.submitId = undefined;
  	}
          if (validator != undefined) {
  	  finished = validator(this) && finished;
          }
  	if (finished) {
              break;
          }
      }
  }
  
  Form.prototype._show = function(uri, lastWebCont, timeToLive) {
      var k = new Continuation();
      var wk = new WebContinuation(cocoon, k, lastWebCont, timeToLive);
      var bizData = this.form;
      if (bizData == undefined) {
          bizData = null;
      }
      this.lastWebContinuation = wk;
      cocoon.request.setAttribute(this.attrName, this.form);
      cocoon.forwardTo("cocoon://" + 
                            cocoon.environment.getURIPrefix() + uri,
                            bizData, wk);
      suicide();
  }
  
  Form.prototype.finish = function() {
    this.rootContinuation.invalidate();
    this.rootContinuation = null;
    this.lastWebContinuation = null;
    this.form = null;
    this.formWidget = null;
  }
  
  Form.prototype.getSubmitId = function() {
    return this.submitId;
  }
  
  function woody(application, form_definition, attribute_name) {
      var args = new Array(arguments.length - 2 + 1);
      args[0] = new Form(form_definition, attribute_name);
      for (var i = 2; i < arguments.length; i++) {
        args[i-1] = arguments[i];
      }
      this[application].apply(this, args);
  }
  
  
  
  1.2       +1 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Button.java
  
  Index: Button.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Button.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Button.java	14 May 2003 11:35:38 -0000	1.1
  +++ Button.java	5 Jul 2003 22:53:33 -0000	1.2
  @@ -76,7 +76,7 @@
   
       public void readFromRequest(FormContext formContext) {
           String value = formContext.getRequest().getParameter(getFullyQualifiedId());
  -        if (value != null && value.equals("selected")) {
  +        if (value != null) {
               formContext.setActionEvent(new ActionEvent() {
                   public String getActionCommand() {
                       return definition.getActionCommand();
  
  
  
  1.6       +4 -0      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Field.java
  
  Index: Field.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Field.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Field.java	2 Jul 2003 11:42:12 -0000	1.5
  +++ Field.java	5 Jul 2003 22:53:33 -0000	1.6
  @@ -79,6 +79,10 @@
           this.definition = fieldDefinition;
       }
   
  +    public FieldDefinition getFieldDefinition() {
  +        return this.definition;
  +    }
  +
       public String getId() {
           return definition.getId();
       }
  
  
  
  1.7       +0 -1      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Form.java
  
  Index: Form.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Form.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Form.java	4 Jul 2003 17:55:16 -0000	1.6
  +++ Form.java	5 Jul 2003 22:53:33 -0000	1.7
  @@ -142,7 +142,6 @@
       public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
           AttributesImpl formAttrs = new AttributesImpl();
           formAttrs.addCDATAAttribute("id", definition.getId());
  -
           contentHandler.startElement(Constants.WI_NS, FORM_EL, Constants.WI_PREFIX_COLON + FORM_EL, Constants.EMPTY_ATTRS);
           definition.generateLabel(contentHandler);
   
  
  
  
  1.6       +53 -0     cocoon-2.1/src/blocks/woody/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/sitemap.xmap,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- sitemap.xmap	16 May 2003 14:33:11 -0000	1.5
  +++ sitemap.xmap	5 Jul 2003 22:53:33 -0000	1.6
  @@ -48,6 +48,10 @@
     </map:view>
    </map:views>
   
  +  <!-- indicates what flowscript to attach to this sitemap -->
  +  <map:flow language="JavaScript">
  +    <map:script src="flow/woody_flow_example.js"/>
  +  </map:flow>
   
    <map:pipelines>
      <map:pipeline>
  @@ -120,6 +124,55 @@
            <map:parameter name="remove" value="{0}"/>
          </map:transform>
          <map:serialize/>
  +     </map:match>
  +        
  +    <!-- Flowscript Sample -->
  +
  +     <map:match pattern="form1.flow">
  +           <map:call function="woody">
  +             <map:parameter name="function" value="form1"/>
  +             <map:parameter name="form-definition" value="forms/form1.xml"/>
  +             <map:parameter name="attribute-name" value="form1"/>
  +           </map:call>
  +     </map:match>
  +
  +     <map:match pattern="*.continue">
  +           <map:call continuation="{1}"/>
  +     </map:match>
  +
  +     <map:match pattern="form1-display-pipeline">
  +       <!-- pipeline to show the form -->
  +       <map:generate type="serverpages" src="forms/form1_template.xsp"/>
  +       <map:transform type="woody">
  +         <map:parameter name="attribute-name" value="form1"/>
  +       </map:transform>
  +
  +       <map:transform type="i18n">
  +         <map:parameter name="locale" value="en-US"/>
  +       </map:transform>
  +       <map:transform src="xsl/html/woody-default.xsl"/>
  +       <map:transform type="i18n">
  +         <map:parameter name="locale" value="en-US"/>
  +       </map:transform>
  +       <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
  +         <map:parameter name="contextPath" value="{request:contextPath}"/>
  +         <map:parameter name="servletPath" value="{request:servletPath}"/>
  +         <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +         <map:parameter name="file" value="forms/form1_template.xml"/>
  +         <map:parameter name="remove" value="{0}"/>
  +       </map:transform> 
  +       <map:serialize/>
  +     </map:match>
  +
  +     <map:match pattern="form1-success-pipeline">
  +             <map:generate type="serverpages" src="forms/form1_success.xsp"/>
  +             <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
  +               <map:parameter name="contextPath" value="{request:contextPath}"/>
  +               <map:parameter name="servletPath" value="{request:servletPath}"/>
  +               <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +               <map:parameter name="file" value="forms/form1_success.xsp"/>
  +             </map:transform>
  +             <map:serialize/>
        </map:match>
   
        <!--
  
  
  
  1.2       +1 -0      cocoon-2.1/src/blocks/woody/samples/welcome.xml
  
  Index: welcome.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/welcome.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- welcome.xml	16 May 2003 14:25:37 -0000	1.1
  +++ welcome.xml	5 Jul 2003 22:53:33 -0000	1.2
  @@ -14,6 +14,7 @@
   
    <group name="Woody Samples">
     <sample name="Various" href="form1">This sample shows validation, event handling and various Woody features.</sample>
  +  <sample name="Flowscript" href="form1.flow">The same sample as above using Flowscript.</sample>
   
     <sample name="Registration" href="registration">A simple registration form.</sample>
    </group>
  
  
  
  1.1                  cocoon-2.1/src/blocks/woody/samples/flow/woody_flow_example.js
  
  Index: woody_flow_example.js
  ===================================================================
  cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody.js");
  
  function form1(form) {
      var model = form.getModel();
      model.email = "bar@www.foo.com";
      model.somebool = true;
      model.account = 2;
      model.cowheight = 4;
      model.number1 = 1;
      model.number2 = 3;
      
      model.contacts[0].firstname = "Jules";
      model.contacts[1].firstname =  "Lucien";
      model.contacts[2].firstname = "Chris";
      model.drinks = ["Jupiler", "Coca Cola"];
      
      form.show("form1-display-pipeline", function(form) {
          print("submitId="+form.getSubmitId());
          switch(form.getSubmitId()) {
          case "remove-selected-contacts":
              {
                  for (var i = model.contacts.length-1; i >= 0; i--) {
                      if (model.contacts[i].select) {
                          model.contacts.remove(i);
                      }
                  }
              }
              break;
          case "add-contact":
              {
                  model.contacts.length++;
              }
              break;
          default:
              return true;
          }
          return false;
      });
      print("visa="+model.visa);
      sendPage("form1-success-pipeline");
      form.finish();
  
  }
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/woody/samples/forms/form1_template.xsp
  
  Index: form1_template.xsp
  ===================================================================
  <?xml version="1.0"?>
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:jpath="http://apache.org/xsp/jpath/1.0">
  <page xmlns:wt="http://apache.org/cocoon/woody/template/1.0">
    <title>Sample form</title>
    <content>
      <form method="POST">
        <xsp:attribute name="action"><xsp:expr><jpath:continuation/>+".continue"</xsp:expr></xsp:attribute>
  
        <table border="1">
          <tr>
            <td valign="top"><wt:widget-label id="email"/></td>
            <td valign="top"><wt:widget id="email"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="fourchars"/></td>
            <td valign="top">
              <!-- The extra content inside the widget element will be
              used by the XSL to determine its behaviour -->
              <wt:widget id="fourchars">
                <list-style>listbox</list-style>
                <listbox-size>4</listbox-size>
              </wt:widget>
            </td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="number1"/></td>
            <td valign="top"><wt:widget id="number1"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="number2"/></td>
            <td valign="top"><wt:widget id="number2"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="account"/></td>
            <td valign="top"><wt:widget id="account"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="cowheight"/></td>
            <td valign="top">
              <wt:widget id="cowheight">
                <list-style>radio</list-style>
              </wt:widget>
            </td>
          </tr>
          <tr>
            <td/>
            <td><wt:widget id="somebool"/> <wt:widget-label id="somebool"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="drinks"/></td>
            <td valign="top"><wt:widget id="drinks"/></td>
          </tr>
          <tr>
            <td valign="top"><wt:widget-label id="visa"/></td>
            <td valign="top"><wt:widget id="visa"/></td>
          </tr>
        </table>
  
        <wt:widget-label id="contacts"/><br/>
        <wt:repeater-size id="contacts"/>
        <table border="1">
          <tr>
            <th><wt:repeater-widget-label id="contacts" widget-id="firstname"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="lastname"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="phone"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="email"/></th>
            <th><wt:repeater-widget-label id="contacts" widget-id="select"/></th>
          </tr>
  
          <!-- The contents of the repeater-widget element is a template that will
          be applied to each row in the repeater. -->
          <wt:repeater-widget id="contacts">
            <tr>
              <td><wt:widget id="firstname"/></td>
              <td><wt:widget id="lastname"/></td>
              <td><wt:widget id="phone"/></td>
              <td><wt:widget id="email"/></td>
              <td><wt:widget id="select"/></td>
            </tr>
          </wt:repeater-widget>
  
          <tr>
            <td colspan="4" align="right">
              <wt:widget id="addcontact"/>
              <wt:widget id="removecontacts"/>
            </td>
          </tr>
        </table>
  
        <input type="submit"/>
      </form>
    </content>
  </page>
  </xsp:page>
  
  
  1.5       +3 -3      cocoon-2.1/src/blocks/woody/samples/xsl/html/woody-default.xsl
  
  Index: woody-default.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/xsl/html/woody-default.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- woody-default.xsl	26 Jun 2003 09:19:29 -0000	1.4
  +++ woody-default.xsl	5 Jul 2003 22:53:33 -0000	1.5
  @@ -93,9 +93,9 @@
     </xsl:template>
   
     <xsl:template match="wi:button">
  -    <button name="{@id}" value="selected" type="submit">
  -      <xsl:copy-of select="wi:label/node()"/>
  -    </button>
  +    <input type="submit" name="{@id}">
  +      <xsl:attribute name="value"><xsl:value-of select="wi:label/node()"/></xsl:attribute>
  +    </input>
     </xsl:template>
   
     <xsl:template match="wi:multivaluefield">