|
Unfortunately there are too many variables for me to provide a definitive, or even useful, answer to your question. Even if I could, it places too much attention on HTML forms instead of general XML Schema transformation techniques.
However, your question does raise three issues that I did not cover in the article:
1. Transforming schemas with instance documents
To determine whether maxOccurs has been reached, you need some reference to an instance document. How you do that can depend on your transformation engine. We pass the node from the instance document into the XSLT processor as a parameter. This approach allows us to use XSLT to build forms that can both edit elements from instance documents and create new elements.
2. Dealing with complex elements
The sample XSLT will build a form from of a complex element definition with simple children, ignoring any complex children. In some cases, you may want to consider a separate tree view for users to add, move, and copy complex children. The appinfo element in the schema also provides an excellent place to define how a complex element appears in a schema with icon image references and the like.
3. Post back
The article does not say much about building a new instance element from the user-entered data in the form. However, the "targetElementForm" mode is a useful place to create hidden form elements to hold element order and position information.
Hope this helps.
-Eric G.
|