[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-cocoon-docs
Subject: [Cocoon Wiki] Update of "Schema2CocoonForms" by NielsVanKampenhout
From: Apache Wiki <wikidiffs () apache ! org>
Date: 2006-11-01 10:19:16
Message-ID: 20061101101916.16286.25530 () ajax ! apache ! org
[Download RAW message or body]
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change \
notification.
The following page has been changed by NielsVanKampenhout:
http://wiki.apache.org/cocoon/Schema2CocoonForms
The comment on the change is:
New version that works with Cocoon 2.1.9
------------------------------------------------------------------------------
= 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 (http://www.hippo.nl), 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: attachment:schema2form_v2.zip. + A returning question on the \
cocoon user list is "Can I generate a Cocoon Form from an XML schema?". At Hippo \
(http://www.hippo.nl), 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. + 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.
The difficulty with schemas is that they can contain an implicit structure by means \
of references to elements. The example XSLs can transform schemas 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 =
+
+ 1. Install Cocoon 2.1.9
+ 2. Create a folder '''schema2form''' under your '''cocoon/webapp''' folder.
+ 3. Download attachment:schema2form_cocoon_2_1_9.zip and unzip it inside \
'''schema2form'''. + 4. Start Cocoon
+ 5. Point your browser to http://localhost:8888/schema2form/form-example
The ZIP file contains 8 files:
* '''sitemap.xmap'''
@@ -20, +26 @@
* '''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. You may have to change some paths in the sitemap, as well as the \
resources-uri in forms-*-styling.xsl, to get the example working.
-
= Remarks =
+ * The latest version (attachment:schema2form_cocoon_2_1_9.zip) now works with \
Cocoon 2.1.9 and is easier to install then the previous versions. +
- * The new v2 version of the ZIP file contains updated XSLs with limited support \
for repeaters. Any element with a maxOccurs="unbounded" attribute will result in a \
repeater in the form. This code was incomplete and commented out in the previous \
version (attachment:schema2form.zip). + * The v2 version of the ZIP file contains \
updated XSLs with limited support for repeaters. Any element with a \
maxOccurs="unbounded" attribute will result in a repeater in the form. This code was \
incomplete and commented out in the previous version (attachment:schema2form.zip).
* 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 \
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=108323069201433&w=2 for a \
description of the problem.
-
- * This example was tested with Cocoon 2.1.5. It is reported not to work with more \
recent Cocoon releases.
= Feedback wanted =
@@ -36, +40 @@
NielsVanKampenhout
-
- = Comments =
- I think that <hm:label> and <hm:hint> should be replace by <fd:label> and \
<fd:help>
-
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic