You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by iv...@apache.org on 2002/06/02 05:33:36 UTC
cvs commit: xml-cocoon2/src/webapp/stylesheets/xmlform xmlform2html.xsl
ivelin 2002/06/01 20:33:36
Modified: src/documentation/xdocs/xmlform Tag: cocoon_2_0_3_branch
index.xml
src/java/org/apache/cocoon/components/validation
Validator.java
src/java/org/apache/cocoon/components/validation/schematron
SchematronValidator.java ValidationResult.java
src/java/org/apache/cocoon/components/xmlform Form.java
src/java/org/apache/cocoon/samples/xmlform UserBean.java
src/java/org/apache/cocoon/transformation
XMLFormTransformer.java
src/webapp/WEB-INF/db cocoondb.backup cocoondb.data
cocoondb.properties cocoondb.script
src/webapp/samples/xmlform/stylesheets wizard2html.xsl
src/webapp/samples/xmlform/wizard confirm.xml system.xml
userIdentity.xml
src/webapp/stylesheets/xmlform xmlform2html.xsl
Added: lib/optional commons-jxpath.jar
Removed: lib/optional commons-jpath-1.0b1.jar
Log:
XMLForm 0.8.4
Changelog:
-
added support for new form elements:
xf:selectMany/checkbox
xf:hidden
xf:selectOne/radio
-
Violations are available in both document order and alphabetical order
Form.getViolations() - document order
Form.getViolationsAsSortedSet - alphabetical xpath order
-
Minor styling improvement of the demo app.
-
Added selectMany/checbox, selectOne/radio and hidden elements in the
Feedback Wizard demo.
Revision Changes Path
1.3 +451 -511 xml-cocoon2/lib/optional/commons-jxpath.jar
<<Binary file>>
No revision
No revision
1.2.2.2 +2 -1 xml-cocoon2/src/documentation/xdocs/xmlform/Attic/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/xmlform/Attic/index.xml,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- index.xml 27 May 2002 17:34:55 -0000 1.2.2.1
+++ index.xml 2 Jun 2002 03:33:35 -0000 1.2.2.2
@@ -71,7 +71,7 @@
</li>
<li>Remote Portal Forms, by taking
<link href="http://my.netscape.com/publish/formats/rss-spec-0.91.html#example1">RSS</link>
- to the new generation of dynamic federated content.
+ to the new generation of dynamic content syndication.
</li>
</ul>
<p>
@@ -108,6 +108,7 @@
</body>
</document>
+
1.2 +4 -4 xml-cocoon2/src/java/org/apache/cocoon/components/validation/Validator.java
Index: Validator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/Validator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Validator.java 20 May 2002 07:19:24 -0000 1.1
+++ Validator.java 2 Jun 2002 03:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/Validator.java,v 1.1 2002/05/20 07:19:24 ivelin Exp $
- * $Revision: 1.1 $
- * $Date: 2002/05/20 07:19:24 $
+ * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/Validator.java,v 1.2 2002/06/02 03:33:35 ivelin Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/06/02 03:33:35 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -61,7 +61,7 @@
*/
package org.apache.cocoon.components.validation;
-import java.util.SortedSet;
+import java.util.List;
/**
*
@@ -84,7 +84,7 @@
* @throws RuntimeException if the validation process fails
* Should not happen in a normal environment.
*/
- SortedSet validate(Object instance);
+ List validate(Object instance);
/**
* This property can be used for partial document validation.
1.2 +5 -5 xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronValidator.java
Index: SchematronValidator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SchematronValidator.java 20 May 2002 07:19:25 -0000 1.1
+++ SchematronValidator.java 2 Jun 2002 03:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronValidator.java,v 1.1 2002/05/20 07:19:25 ivelin Exp $
- * $Revision: 1.1 $
- * $Date: 2002/05/20 07:19:25 $
+ * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/SchematronValidator.java,v 1.2 2002/06/02 03:33:35 ivelin Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/06/02 03:33:35 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -239,7 +239,7 @@
* @return A Result object which represents the result
* of the validation.
*/
- public SortedSet validate( Object jbean )
+ public List validate( Object jbean )
{
List patterns = null;
if (phaseProperty_ != null)
@@ -271,7 +271,7 @@
}
}
- return vres.toSortedSet();
+ return vres.toList();
}
/**
1.2 +7 -7 xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/ValidationResult.java
Index: ValidationResult.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/ValidationResult.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ValidationResult.java 20 May 2002 07:19:25 -0000 1.1
+++ ValidationResult.java 2 Jun 2002 03:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/ValidationResult.java,v 1.1 2002/05/20 07:19:25 ivelin Exp $
- * $Revision: 1.1 $
- * $Date: 2002/05/20 07:19:25 $
+ * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/validation/schematron/ValidationResult.java,v 1.2 2002/06/02 03:33:35 ivelin Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/06/02 03:33:35 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -67,8 +67,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.SortedSet;
-import java.util.TreeSet;
+import java.util.List;
+import java.util.LinkedList;
import org.apache.cocoon.components.validation.Violation;
@@ -126,12 +126,12 @@
* @todo implement this method !!!
* @return SortedSet
*/
- public SortedSet toSortedSet()
+ public List toList()
{
if ( isEmpty() ) return null;
- SortedSet violations = new TreeSet();
+ List violations = new LinkedList();
Iterator piter = getPattern().iterator();
while (piter.hasNext ())
1.2 +89 -12 xml-cocoon2/src/java/org/apache/cocoon/components/xmlform/Form.java
Index: Form.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xmlform/Form.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Form.java 20 May 2002 07:19:25 -0000 1.1
+++ Form.java 2 Jun 2002 03:33:35 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xmlform/Form.java,v 1.1 2002/05/20 07:19:25 ivelin Exp $
- * $Revision: 1.1 $
- * $Date: 2002/05/20 07:19:25 $
+ * $Header: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xmlform/Form.java,v 1.2 2002/06/02 03:33:35 ivelin Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/06/02 03:33:35 $
*
* ====================================================================
* The Apache Software License, Version 1.1
@@ -68,6 +68,7 @@
import java.util.Set;
import java.util.HashSet;
import java.util.TreeSet;
+import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
@@ -99,7 +100,7 @@
* NOTE: This class is NOT thread safe
*
* @author Ivelin Ivanov, ivelin@apache.org
- * @version $Revision: 1.1 $ $Date: 2002/05/20 07:19:25 $
+ * @version $Revision: 1.2 $ $Date: 2002/06/02 03:33:35 $
*/
public class Form
@@ -162,15 +163,20 @@
}
- public SortedSet getViolations()
+ public List getViolations()
{
return violations_;
}
+ public SortedSet getViolationsAsSortedSet()
+ {
+ return violationsAsSortedSet_;
+ }
public void clearViolations()
{
violations_ = null;
+ violationsAsSortedSet_ = null;
}
@@ -191,6 +197,28 @@
public void setValue(String xpath, Object[] values)
{
+
+// // Dmitri Plotnikov's patch
+//
+// // if there are multiple values to set
+// // (like in the selectMany case),
+// // iterate over the array and set individual values
+// if ( values.length > 1 )
+// {
+// Iterator iter = jxcontext_.iteratePointers(xpath);
+// for (int i = 0; i < values.length; i++ )
+// {
+// Pointer ptr = (Pointer)iter.next();
+// ptr.setValue(values[i]);
+// }
+// }
+// else
+// {
+// // This is supposed to do the right thing
+// jxcontext_.setValue(xpath, values);
+// }
+//
+
Pointer pointer = jxcontext_.locateValue( xpath );
Object property = pointer.getValue();
// if there are multiple values to set
@@ -222,9 +250,15 @@
protected void setValue( Pointer pointer, Object value)
{
+
+// // Dmitri Plotnikov's patch
+// pointer.setValue(value);
+
Object property = pointer.getValue();
if ( property != null )
{
+
+
// handle DOM elements
if (property instanceof Element)
{
@@ -277,6 +311,12 @@
*/
public Object getValue(String xpath)
{
+
+// // Dmitri Plotnikov's patch
+// if (model_ == null)
+// throw new IllegalStateException( "Form model not set" );
+// return jxcontext_.getValue(xpath);
+
if (model_ == null)
throw new IllegalStateException( "Form model not set" );
Pointer pointer = jxcontext_.locateValue( xpath );
@@ -350,7 +390,11 @@
validator_.setProperty( Validator.PROPERTY_PHASE, phase );
violations_ = validator_.validate( model_ );
if (violations_ == null) return true;
- else return false;
+ else
+ {
+ updateViolationsAsSortedSet();
+ return false;
+ }
}
@@ -372,15 +416,19 @@
public void populate( Map objectModel )
{
// clean violations_ set
- violations_ = null;
+ clearViolations();
+
// let listeners know that
// population is about to start
reset();
- // generic data format violations
+ // data format violations
// gathered during population
- SortedSet pviolations = new TreeSet();
+ // For example when
+ // a request parameter value is "saymyname"
+ // while the request parameter name points to an int attribute
+ List pviolations = new ArrayList();
Request request =getRequest( objectModel );
@@ -420,21 +468,41 @@
{
if ( !pviolations.isEmpty () ) violations_ = pviolations;
}
+ if ( violations_ != null)
+ {
+ updateViolationsAsSortedSet();
+ }
}
+ /** create a SortedSet view of the violations collection
+ * for convenience of processors down the pipeline
+ * protected void updateViolationsAsSortedSet()
+ */
+ protected void updateViolationsAsSortedSet()
+ {
+ violationsAsSortedSet_ = new TreeSet( violations_ );
+ }
+
/**
*
* Convenience method invoked after populate()
* By default it performs Form model validation.
- * If default validation is not necessary or the validation
+ *
+ * <br>
+ * - If default validation is not necessary
+ * setAutoValidate( false ) should be used
+ *
+ * <br>
+ * If the validation
* criteria needs to be different, subclasses can override
* this method to change the behaviour.
*
*/
protected void autoValidate( Map objectModel )
{
+ if (!autoValidateEnabled_) return;
// perform validation for the phase
// which matches the name of the current form view
// if one is available
@@ -624,11 +692,20 @@
}
-
+ public void setAutoValidate( boolean newAVFlag)
+ {
+ autoValidateEnabled_ = newAVFlag;
+ }
/** the set of violations the model commited during validation */
- private SortedSet violations_ = null;
+ private List violations_ = null;
+
+ /** another view of the violations_ collection */
+ private SortedSet violationsAsSortedSet_ = null;
+
+ /** flag allowing control over automatic validation on populate() */
+ private boolean autoValidateEnabled_ = true;
/** The data model this form encapsulates */
private Object model_ = null;
1.2 +13 -1 xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/UserBean.java
Index: UserBean.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/UserBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UserBean.java 20 May 2002 07:19:26 -0000 1.1
+++ UserBean.java 2 Jun 2002 03:33:35 -0000 1.2
@@ -33,6 +33,8 @@
private List roles = new ArrayList();
private String hobbies[];
+ private boolean hidden = false;
+
private Node system;
public UserBean ()
@@ -118,6 +120,16 @@
system = newSystem;
}
+ public boolean getHidden()
+ {
+ return hidden;
+ }
+
+ public void setHidden( boolean newHidden )
+ {
+ hidden = newHidden;
+ }
+
public int getCount() {
return count;
}
@@ -215,7 +227,7 @@
public void initHobbies()
{
- hobbies = new String[] {"", "", "", "", ""};
+ hobbies = new String[] {"swim", "movies", "ski", "gym", "soccer"};
}
1.4 +5 -1 xml-cocoon2/src/java/org/apache/cocoon/transformation/XMLFormTransformer.java
Index: XMLFormTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/XMLFormTransformer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLFormTransformer.java 28 May 2002 13:08:13 -0000 1.3
+++ XMLFormTransformer.java 2 Jun 2002 03:33:35 -0000 1.4
@@ -100,6 +100,10 @@
public class XMLFormTransformer extends AbstractSAXTransformer
{
+ // @todo : implements Cacheable {
+
+
+
public final static String NS = "http://xml.apache.org/cocoon/xmlform/2002";
private final static String NS_PREFIX = "xf";
public final static Attributes NOATTR = new AttributesImpl();
@@ -490,7 +494,7 @@
protected void startElementViolations(String uri, String name, String raw, Attributes attributes) throws SAXException
{
- SortedSet violations = currentForm.getViolations();
+ SortedSet violations = currentForm.getViolationsAsSortedSet();
// if there are no violations, there is nothing to show
if (violations == null) return;
1.3 +1 -1 xml-cocoon2/src/webapp/WEB-INF/db/cocoondb.backup
<<Binary file>>
1.5 +1 -1 xml-cocoon2/src/webapp/WEB-INF/db/cocoondb.data
<<Binary file>>
1.6 +1 -1 xml-cocoon2/src/webapp/WEB-INF/db/cocoondb.properties
Index: cocoondb.properties
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/db/cocoondb.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cocoondb.properties 23 May 2002 13:39:47 -0000 1.5
+++ cocoondb.properties 2 Jun 2002 03:33:35 -0000 1.6
@@ -1,4 +1,4 @@
#HSQL database
-#Wed May 22 22:39:57 CDT 2002
+#Sat Jun 01 22:28:33 CDT 2002
version=1.6
modified=yes
1.7 +3 -7 xml-cocoon2/src/webapp/WEB-INF/db/cocoondb.script
Index: cocoondb.script
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/db/cocoondb.script,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- cocoondb.script 23 May 2002 13:39:47 -0000 1.6
+++ cocoondb.script 2 Jun 2002 03:33:35 -0000 1.7
@@ -4,8 +4,8 @@
CREATE TABLE GROUPS(GID INTEGER IDENTITY PRIMARY KEY,GNAME VARCHAR,UNIQUE(GNAME))
CREATE TABLE USER_GROUPS(UID INTEGER,GID INTEGER,UNIQUE(UID,GID),FOREIGN KEY(UID)REFERENCES USER(UID),FOREIGN KEY(GID)REFERENCES GROUPS(GID))
CREATE TABLE STATE_TAX(CATEGORY VARCHAR NOT NULL,GROSSTAX_COLLECTED DOUBLE NOT NULL,NETTAX_COLLECTED DOUBLE NOT NULL,YEAR INTEGER NOT NULL)
-GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC
+GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
CREATE USER SA PASSWORD "" ADMIN
CREATE ALIAS DAYNAME FOR "org.hsqldb.Library.dayname"
CREATE ALIAS SPACE FOR "org.hsqldb.Library.space"
@@ -115,9 +115,5 @@
INSERT INTO STATE_TAX VALUES('Horse Racing',1.7921198E7,1.7321198E7,2001)
INSERT INTO STATE_TAX VALUES('Severance',7981539.0,7967438.0,2001)
INSERT INTO STATE_TAX VALUES('School District Income',1.61257059E8,1.53238001E8,2001)
-/*C1*/CONNECT USER sa PASSWORD ""
-/*C2*/CONNECT USER sa PASSWORD ""
-CONNECT USER sa PASSWORD ""
-/*C5*/CONNECT USER sa PASSWORD ""
-/*C6*/CONNECT USER sa PASSWORD ""
-/*C8*/CONNECT USER sa PASSWORD ""
+/*C3*/CONNECT USER sa PASSWORD ""
+/*C4*/CONNECT USER sa PASSWORD ""
1.2 +21 -14 xml-cocoon2/src/webapp/samples/xmlform/stylesheets/wizard2html.xsl
Index: wizard2html.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/xmlform/stylesheets/wizard2html.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- wizard2html.xsl 20 May 2002 13:33:50 -0000 1.1
+++ wizard2html.xsl 2 Jun 2002 03:33:35 -0000 1.2
@@ -28,16 +28,17 @@
BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;}
B{color : white;background-color : #0086b2;}
HR{color : #0086b2;}
- input { background-color: #FFFFFF; color: #000099 }
- table { background-color: #EEEEEE; color: #000099; font-size: x-small; border: 2px solid brown;}
- select { background-color: #FFFFFF; color: #000099 }
- .error { color: #FF0000; }
- .invalid { color: #FF0000; border: 2px solid #FF0000; }
- .info { color: #0000FF; border: 1px solid #0000FF; }
- .repeat { border: 0px inset #999999;border: 1px inset #999999; width: 100%; }
- .group { border: 0px inset #999999;border: 0px inset #999999; width: 100%; }
- .sub-table { border: none; }
- .button { background-color: #FFFFFF; color: #000099; border: 1px solid #666666; width: 70px; }
+ input { background-color: #FFFFFF; color: #000099; border: 1px solid #0000FF; }
+ table { background-color: #EEEEEE; color: #000099; font-size: x-small; border: 2px solid brown;}
+ select { background-color: #FFFFFF; color: #000099 }
+ .error { color: #FF0000; }
+ .invalid { color: #FF0000; border: 2px solid #FF0000; }
+ .info { color: #0000FF; border: 1px solid #0000FF; }
+ .repeat { border: 0px inset #999999;border: 1px inset #999999; width: 100%; }
+ .group { border: 0px inset #999999;border: 0px inset #999999; width: 100%; }
+ .sub-table { border: none; }
+ .button { background-color: #FFFFFF; color: #000099; border: 1px solid #666666; width: 70px; }
+ .plaintable { border: 0px inset black;border: 0px inset black; width: 100%; }
]]>
</style>
</head>
@@ -145,22 +146,28 @@
<xsl:template match="xf:*">
- <tr>
+ <tr>
<td align="left">
<xsl:value-of select="xf:caption" />
</td>
- <td>
+ <td align="left">
+ <table class="plaintable">
+ <tr>
+ <td align="left">
<xsl:copy-of select="." />
</td>
<xsl:if test="xf:violation">
- <td class="{xf:violation[1]/@class}" width="100%">
+ <td align="left" class="{xf:violation[1]/@class}" width="100%">
<xsl:for-each select="xf:violation">
* <xsl:value-of select="." />
<br/>
</xsl:for-each>
</td>
</xsl:if>
- </tr>
+ </tr>
+ </table>
+ </td>
+ </tr>
</xsl:template>
1.2 +14 -3 xml-cocoon2/src/webapp/samples/xmlform/wizard/confirm.xml
Index: confirm.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/xmlform/wizard/confirm.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- confirm.xml 20 May 2002 13:33:50 -0000 1.1
+++ confirm.xml 2 Jun 2002 03:33:35 -0000 1.2
@@ -44,7 +44,18 @@
</xf:repeat>
</xf:group>
- <!-- from page2 -->
+ <xf:group ref="/">
+ <xf:caption>Personal hobbies</xf:caption>
+ <xf:repeat nodeset="/hobby">
+ <xf:output ref="."/>
+ </xf:repeat>
+ </xf:group>
+
+ <xf:output ref="/hidden">
+ <xf:caption>Hidden attribute</xf:caption>
+ </xf:output>
+
+ <!-- from page2 -->
<xf:output ref="/number">
<xf:caption>Number of installations</xf:caption>
@@ -92,8 +103,8 @@
</xf:output>
</xf:repeat>
</xf:group>
-
-
+
+
<!-- submit -->
<xf:submit id="prev" class="button">
1.2 +1 -1 xml-cocoon2/src/webapp/samples/xmlform/wizard/system.xml
Index: system.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/xmlform/wizard/system.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- system.xml 20 May 2002 13:33:50 -0000 1.1
+++ system.xml 2 Jun 2002 03:33:35 -0000 1.2
@@ -24,7 +24,7 @@
<xf:group ref="/system">
- <xf:selectOne ref="os">
+ <xf:selectOne ref="os" selectUIType='radio'>
<xf:caption>OS</xf:caption>
<xf:item id="unix">
<xf:caption>Unix/Linux</xf:caption>
1.2 +45 -0 xml-cocoon2/src/webapp/samples/xmlform/wizard/userIdentity.xml
Index: userIdentity.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/xmlform/wizard/userIdentity.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- userIdentity.xml 20 May 2002 13:33:50 -0000 1.1
+++ userIdentity.xml 2 Jun 2002 03:33:35 -0000 1.2
@@ -81,6 +81,51 @@
</xf:item>
</xf:selectMany>
+ <xf:selectMany ref="/hobby" selectUIType='checkbox'>
+ <xf:caption>Hobbies</xf:caption>
+ <xf:item>
+ <xf:caption>Swimming</xf:caption>
+ <xf:value>swim</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Body Building</xf:caption>
+ <xf:value>gym</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Skiing</xf:caption>
+ <xf:value>ski</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Running</xf:caption>
+ <xf:value>run</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Football</xf:caption>
+ <xf:value>football</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Reading</xf:caption>
+ <xf:value>read</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Writing</xf:caption>
+ <xf:value>write</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Soccer</xf:caption>
+ <xf:value>soccer</xf:value>
+ </xf:item>
+ <xf:item>
+ <xf:caption>Blogging</xf:caption>
+ <xf:value>blog</xf:value>
+ </xf:item>
+ </xf:selectMany>
+
+ <!-- hidden model attribute -->
+ <xf:hidden ref="/hidden">
+ <xf:value>true</xf:value>
+ </xf:hidden>
+
<xf:submit id="next" class="button">
<xf:caption>Next</xf:caption>
</xf:submit>
1.2 +48 -10 xml-cocoon2/src/webapp/stylesheets/xmlform/xmlform2html.xsl
Index: xmlform2html.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/webapp/stylesheets/xmlform/xmlform2html.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xmlform2html.xsl 20 May 2002 06:53:17 -0000 1.1
+++ xmlform2html.xsl 2 Jun 2002 03:33:36 -0000 1.2
@@ -3,7 +3,7 @@
<!--
- Generic XMLForm processing stylesheet.
+ Basic XMLForm processing stylesheet.
Converts XMLForm tags to HTML tags.
Syntax is borrowed from the XForms standard.
@@ -14,9 +14,12 @@
tags on the page is complete. At this stage xmlform tags
are rendered in device specific format.
+ Different widgets are broken into templates
+ to allow customization in importing stylesheets
+
author: Ivelin Ivanov, ivelin@apache.org, May 2002
author: Michael Ratliff, mratliff@collegenet.com <mr...@collegenet.com>, May 2002
- Original Author: Torsten Curdt, tcurdt@dff.st, March 2002
+ author: Torsten Curdt, tcurdt@dff.st, March 2002
-->
@@ -45,24 +48,28 @@
</xsl:template>
<xsl:template match="xf:textbox">
- <input name="{@ref}" type="textbox" value="{xf:value/text()}" />
+ <input name="{@ref}" type="textbox" value="{xf:value/text()}" class="{@class}"/>
</xsl:template>
<xsl:template match="xf:password">
- <input name="{@ref}" type="password" value="{xf:value/text()}" />
+ <input name="{@ref}" type="password" value="{xf:value/text()}" class="{@class}"/>
+ </xsl:template>
+
+ <xsl:template match="xf:hidden">
+ <input name="{@ref}" type="hidden" value="{xf:value/text()}" class="{@class}"/>
</xsl:template>
<xsl:template match="xf:selectBoolean">
- <input name="{@ref}" type="checkbox" value="true">
+ <input name="{@ref}" type="checkbox" value="true" class="{@class}">
<xsl:if test="xf:value/text() = 'true'">
<xsl:attribute name="checked"/>
</xsl:if>
</input>
</xsl:template>
- <xsl:template match="xf:selectOne">
- <select name="{@ref}">
- <xsl:variable name="selected" select="xf:value/text()"/>
+ <xsl:template match="xf:selectOne | xf:selectOne[@selectUIType='listbox']">
+ <select name="{@ref}" class="{@class}">
+ <xsl:variable name="selected" select="xf:value"/>
<xsl:for-each select="xf:item">
<option value="{xf:value}">
<xsl:if test="$selected = xf:value">
@@ -73,11 +80,25 @@
</xsl:for-each>
</select>
</xsl:template>
+
+ <xsl:template match="xf:selectOne[@selectUIType='radio']">
+ <xsl:variable name="selected" select="xf:value"/>
+ <xsl:variable name="ref" select="@ref"/>
+ <xsl:for-each select="xf:item">
+ <input name="{$ref}" type="radio" value="{xf:value}" class="{@class}">
+ <xsl:if test="xf:value = $selected">
+ <xsl:attribute name="checked"/>
+ </xsl:if>
+ </input>
+ <xsl:value-of select="xf:caption"/>
+ <br/>
+ </xsl:for-each>
+ </xsl:template>
<xsl:template match="xf:selectMany | xf:selectMany[@selectUIType='listbox']">
<xsl:variable name="selected" select="xf:value"/>
- <select name="{@ref}">
+ <select name="{@ref}" class="{@class}">
<xsl:attribute name="multiple"/>
<xsl:for-each select="xf:item">
<option value="{xf:value}">
@@ -90,8 +111,25 @@
</select>
</xsl:template>
+
+ <xsl:template match="xf:selectMany[@selectUIType='checkbox']">
+ <xsl:variable name="selected" select="xf:value"/>
+ <xsl:variable name="ref" select="@ref"/>
+ <xsl:for-each select="xf:item">
+ <input name="{$ref}" type="checkbox" value="{xf:value}" class="{@class}">
+ <xsl:if test="xf:value = $selected">
+ <xsl:attribute name="checked"/>
+ </xsl:if>
+ </input>
+ <xsl:value-of select="xf:caption"/>
+ <br/>
+ </xsl:for-each>
+ </xsl:template>
+
+
+
<xsl:template match="xf:submit">
- <input name="cocoon-action-{@id}" type="submit" value="{xf:caption/text()}" />
+ <input name="cocoon-action-{@id}" type="submit" value="{xf:caption/text()}" class="{@class}"/>
</xsl:template>
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org