cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Cocoon Wiki] Updated: Schema2CocoonForms
Date Thu, 08 Jul 2004 08:04:25 GMT
   Date: 2004-07-08T01:04:24
   Editor: NielsVanKampenhout <>
   Wiki: Cocoon Wiki
   Page: Schema2CocoonForms

   no comment

Change Log:

@@ -1,8 +1,29 @@
+= Generating a form from an XML schema =
 A returning question on the cocoon user list is "Can I generate a Cocoon Form from an XML
schema?". At Hippo (, we have built several websites that make use of
this concept. I have put together a small example that demonstrates transforming an XML schema
into a Cocoon Forms definition, template and binding using three similar XSLs:
 The XSLs in this example were actually one of my firsts attempts at XSL/Schema/Cocoon, so
they are not examples of very good programming. In addition, they can only transform schemas
of a certain, very simple and restricted structure. These XSLs should be considered as a proof
of concept, rather than an example of how it should be done.
-Installation notes:
+The difficulty with schemas is that they can contain an implicit structure by means of references
to elements. The examples XSLs can transform schema with the following structure: a root element
containing references to a number other elements, each having a number of child elements.
See the included schema for an example. Try to edit the schema and see the form adapt to it.
Making forms has never been easier ;)
+= Installation notes =
+The ZIP file contains 8 files:
+ * '''sitemap.xmap'''
+ * '''flow.js''': flowscript for the form
+ * '''lib-io.js''': some IO functions
+ * '''schema2formmodel.xsl''': XSL transforming a schema intro a Cocoon Forms definition
+ * '''schema2formtemplate.xsl''': XSL transforming a schema intro a Cocoon Forms template
+ * '''schema2formbinding.xsl''': XSL transforming a schema intro a Cocoon Forms binding definition
+ * '''example.xsd''': an example XML schema that can be transformed into a form
+ * '''example.xml''': empty XML file used to bind the form to
 The example expects a directory 'cforms', which includes directories 'resources' and 'messages'.
Obviously I did not include them, as they are part of the Cocoon distribution.
+= Remarks =
+ * There is some commented out code for repeater blocks in the XSLs, but as we did not need
repeaters I discontinued working on it. However it should not be difficult to make it work
+ * I noticed that with large schemas/forms, checking checkboxes or radiobuttons becomes a
very frustrating activity, as the time between clicking and seeing the check appear can be
more than a second. See my post on the user list at
for a description of the problem.

View raw message