1.1 --- a/docs/advice.html Mon Oct 03 23:04:48 2005 +0000
1.2 +++ b/docs/advice.html Mon Oct 03 23:05:27 2005 +0000
1.3 @@ -1,12 +1,10 @@
1.4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1.5 -<html xmlns="http://www.w3.org/1999/xhtml">
1.6 -<head>
1.7 +<html xmlns="http://www.w3.org/1999/xhtml"><head>
1.8 <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type" />
1.9 - <title>Creating Applications: Recommendations and Advice</title>
1.10 - <meta name="generator"
1.11 - content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.12 - <link href="styles.css" rel="stylesheet" type="text/css" />
1.13 -</head>
1.14 +
1.15 + <title>Creating Applications: Recommendations and Advice</title><meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.16 + <link href="styles.css" rel="stylesheet" type="text/css" /></head>
1.17 +
1.18 <body>
1.19 <h1>Creating Applications: Recommendations and Advice</h1>
1.20 <ol>
1.21 @@ -21,8 +19,7 @@
1.22 vary within your application, and the nested elements will appear
1.23 at a different position depending on how many such values have been
1.24 inserted. Whilst this might not affect some applications, at least not
1.25 -to begin with, the usage of more advanced features (<a
1.26 - href="in-page-updates.html">in-page updates</a>, for example) will
1.27 +to begin with, the usage of more advanced features (<a href="in-page-updates.html">in-page updates</a>, for example) will
1.28 probably expose
1.29 problems due to the way XSLForms reconstructs the XML document data
1.30 from the input form data.</p>
1.31 @@ -54,7 +51,7 @@
1.32 the necessary elements for the output document so that the resulting
1.33 page gives the user the opportunity to specify data that is missing.
1.34 Consider this section of an example template:</p>
1.35 -<pre><p template:element="package"><br /> <p template:element="author"><br /> Name: <input template:attribute="name" name="{template:this-attribute()}" type="text" value="{$this-value}"/><br /> </p><br /></p></pre>
1.36 +<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></pre>
1.37 <p>Here, if the <code>author</code> element is not found in the
1.38 output structure, no field will be produced in the Web page, no
1.39 opportunity will be given for an author to be specified, and no author
1.40 @@ -62,8 +59,10 @@
1.41 the <code>author</code> element into the XML document when
1.42 creating the <code>package</code> element - this should then
1.43 "bootstrap" the process and ensure that the author details will remain
1.44 -editable as long as the <code>package</code> element exists.</p>
1.45 +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.46 +elements would still be impossible to create in the user interface. The
1.47 +document initialisation mechanism distinguishes between these two cases
1.48 +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.49 <ol>
1.50 </ol>
1.51 -</body>
1.52 -</html>
1.53 +</body></html>
1.54 \ No newline at end of file