XSLTools

Annotated examples/Common/VerySimpleWithOpenID/Resources/structure_multivalue_template.xhtml

692:fd003deb4d59
2009-11-29 Paul Boddie Added fixes from the WebStack example involving credentials, non-ASCII characters, and some XRD-based resources.
paulb@652 1
<?xml version="1.0" encoding="iso-8859-1"?>
paulb@652 2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
paulb@652 3
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
paulb@652 4
<html xmlns="http://www.w3.org/1999/xhtml"
paulb@652 5
      xmlns:template="http://www.boddie.org.uk/ns/xmltools/template">
paulb@652 6
<head>
paulb@652 7
  <title>Example</title>
paulb@652 8
  <script type="text/javascript" src="scripts/sarissa.js"> </script>
paulb@652 9
  <script type="text/javascript" src="scripts/XSLForms.js"> </script>
paulb@652 10
</head>
paulb@652 11
<body template:element="structure">
paulb@652 12
<form action="" method="POST">
paulb@652 13
paulb@652 14
<!-- Template text between the start and the interesting part. -->
paulb@652 15
paulb@652 16
<div template:element="item">
paulb@652 17
  <p>
paulb@652 18
    Some item: <input template:attribute-field="value" name="..." type="text" value="..." />
paulb@652 19
    <input template:selector-field="remove" name="..." type="submit" value="Remove" />
paulb@652 20
  </p>
paulb@652 21
  <p>
paulb@652 22
    Item type:
paulb@652 23
    <select template:multiple-choice-list-field="type,type-enum,value" name="..." multiple="multiple"
paulb@652 24
      onchange="requestUpdate(
paulb@652 25
        'comments',
paulb@652 26
        '{template:list-attribute('type-enum', 'value')}',
paulb@652 27
        '{template:other-elements(../options)}',
paulb@652 28
        '{template:child-attribute('value', template:child-element('comment', 1, template:other-elements(../options)))}',
paulb@652 29
        '/structure/item')">
paulb@652 30
      <option template:multiple-choice-list-value="type-enum,value,selected" value="..." />
paulb@652 31
    </select>
paulb@652 32
  </p>
paulb@652 33
  <p template:element="options" template:section="comment-node" id="{template:this-element()}">
paulb@652 34
    <span template:element="comment">Comment:
paulb@652 35
      <textarea template:attribute-area="value,insert" name="..." cols="40" rows="3">
paulb@652 36
        Some comment
paulb@652 37
      </textarea>
paulb@652 38
    </span>
paulb@652 39
  </p>
paulb@652 40
  <p>
paulb@652 41
    Itself containing more items:
paulb@652 42
  </p>
paulb@652 43
  <p template:element="subitem">
paulb@652 44
    Sub-item: <input template:attribute-field="subvalue" name="..." type="text" value="..." />
paulb@652 45
    <input template:selector-field="remove2" name="..." type="submit" value="Remove" />
paulb@652 46
  </p>
paulb@652 47
  <p>
paulb@652 48
    <input template:selector-field="add2,subitem" name="..." type="submit" value="Add subitem" />
paulb@652 49
  </p>
paulb@652 50
</div>
paulb@652 51
<p>
paulb@652 52
  <input template:selector-field="add,item" name="..." type="submit" value="Add item" />
paulb@652 53
</p>
paulb@652 54
<p>
paulb@652 55
  <input name="update" type="submit" value="Update" />
paulb@652 56
</p>
paulb@652 57
paulb@652 58
<!-- Template text between the interesting part and the end. -->
paulb@652 59
paulb@652 60
</form>
paulb@652 61
</body>
paulb@652 62
</html>