1.1 --- a/docs/advice.html Fri Oct 07 21:32:45 2005 +0000
1.2 +++ b/docs/advice.html Fri Oct 07 21:33:25 2005 +0000
1.3 @@ -4,7 +4,6 @@
1.4
1.5 <title>Creating Applications: Recommendations and Advice</title><meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.6 <link href="styles.css" rel="stylesheet" type="text/css" /></head>
1.7 -
1.8 <body>
1.9 <h1>Creating Applications: Recommendations and Advice</h1>
1.10 <ol>
1.11 @@ -62,7 +61,19 @@
1.12 editable as long as the <code>package</code> element exists.</p><h3>Ensuring Element Structure with Document Initialisation</h3><p>Although it is not necessary to use <a href="multiple.html">document initialisation</a> in resources, the above case would be detected by an input/initialiser stylesheet, and the <code>package</code> and <code>author</code> elements would be added if no way of adding them was mentioned in the template. Typically, we would employ <a href="selectors.html">selectors</a> to provide the ability to add elements in templates, and the above example could be extended as follows:</p><pre><p template:element="package"><br /> <p template:element="author"><br /> Name: <input template:attribute-field="name" name="..." type="text" value="..."/><br /> </p><br /> <p><br /> <input name="..." template:selector-field="add-author,author" type="submit" value="Add author" /><br /> </p><br /></p></pre><p>With the newly-added selector, we can see that <code>author</code> elements could at least be added by users of the application, but <code>package</code>
1.13 elements would still be impossible to create in the user interface. The
1.14 document initialisation mechanism distinguishes between these two cases
1.15 -by looking for selectors which mention element names; here, the <code>template:selector-field</code> attribute has two parts to its value:</p><ol><li>A name used to identify the selector.</li><li>The name of an element: <code>author</code></li></ol><p>Since the <code>author</code> element is mentioned, the mechanism knows not to create such elements automatically. However, since no such selector exists for <code>package</code> elements, those elements are created automatically.</p>
1.16 +by looking for selectors which mention element names; here, the <code>template:selector-field</code> attribute has two parts to its value:</p><ol><li>A name used to identify the selector.</li><li>The name of an element: <code>author</code></li></ol><p>Since the <code>author</code>
1.17 +element is mentioned, the mechanism knows not to create such elements
1.18 +automatically. However, since no such selector exists for <code>package</code> elements, those elements are created automatically.</p><h2>Selecting from the Correct Document</h2><p>After
1.19 +document initialisation or any other transformation, it is necessary to
1.20 +re-evaluate selector information in the context of the updated document
1.21 +if such information is to be used with such updated data, noting that
1.22 +any changes in the structure of the such data will cause the selectors
1.23 +to refer to the wrong parts of documents. To make updated documents
1.24 +available to XSLForms, the following call can be made on the <code>form</code> object (the third parameter in the <code>respond_to_form</code> method):</p><pre>form.set_document(document_name, updated_document)</pre><p>The updated selectors can then be obtained as usual:</p><pre>selectors = form.get_selectors()</pre><p>Typically,
1.25 +selectors should be accessed and used before initialisation since they
1.26 +refer to information that must already exist and can therefore be
1.27 +manipulated without preparatory work being done on the documents
1.28 +involved.</p>
1.29 <ol>
1.30 </ol>
1.31 </body></html>
1.32 \ No newline at end of file