# HG changeset patch # User paulb # Date 1132271228 0 # Node ID 778a1752a07179d1ce04b36185b9b10d057e3ead # Parent 0c6c1d27d9c0bf0feef2fffa984f1c9ff76112e6 [project @ 2005-11-17 23:47:08 by paulb] Added document initialisation cross-referencing. diff -r 0c6c1d27d9c0 -r 778a1752a071 docs/advice.html --- a/docs/advice.html Thu Nov 17 19:46:28 2005 +0000 +++ b/docs/advice.html Thu Nov 17 23:47:08 2005 +0000 @@ -58,7 +58,7 @@ the author element into the XML document when creating the package element - this should then "bootstrap" the process and ensure that the author details will remain -editable as long as the package element exists.

Ensuring Element Structure with Document Initialisation

Although it is not necessary to use document initialisation in resources, the above case would be detected by an input/initialiser stylesheet, and the package and author elements would be added if no way of adding them was mentioned in the template. Typically, we would employ selectors to provide the ability to add elements in templates, and the above example could be extended as follows:

<p template:element="package">
<p template:element="author">
Name: <input template:attribute-field="name" name="..." type="text" value="..."/>
</p>
<p>
<input name="..." template:selector-field="add-author,author" type="submit" value="Add author" />
</p>
</p>

With the newly-added selector, we can see that author elements could at least be added by users of the application, but package +editable as long as the package element exists.

Ensuring Element Structure with Document Initialisation

Although it is not necessary to use document initialisation in resources, the above case would be detected by an input/initialiser stylesheet, and the package and author elements would be added if no way of adding them was mentioned in the template. Typically, we would employ selectors to provide the ability to add elements in templates, and the above example could be extended as follows:

<p template:element="package">
<p template:element="author">
Name: <input template:attribute-field="name" name="..." type="text" value="..."/>
</p>
<p>
<input name="..." template:selector-field="add-author,author" type="submit" value="Add author" />
</p>
</p>

With the newly-added selector, we can see that author elements could at least be added by users of the application, but package elements would still be impossible to create in the user interface. The document initialisation mechanism distinguishes between these two cases by looking for selectors which mention element names; here, the template:selector-field attribute has two parts to its value:

  1. A name used to identify the selector.
  2. The name of an element: author

Since the author diff -r 0c6c1d27d9c0 -r 778a1752a071 docs/multiple.html --- a/docs/multiple.html Thu Nov 17 19:46:28 2005 +0000 +++ b/docs/multiple.html Thu Nov 17 23:47:08 2005 +0000 @@ -85,7 +85,7 @@ will need to find a way of merging the range of allowed values into the user-edited form data before presenting that data using our template.

-

Document Initialisation

+

Document Initialisation

There are many possible ways of inserting extra XML elements into an existing XML document, but XSLForms provides an easy way of defining lists of values that will be included in the way we desire. First, let