XFA Specification
Chapter 6, Template Features for Designing Forms with Repeating Sections
Prototypes
194
The proto element itself can appear as a child of only the
subform element.
This isn't an undue restriction,
as every template element is a descendant of some subform, except for the root-level subforms and their
enclosing template element.
The subform may hold more than one proto element for multiple prototypes, or the prototypes may be
grouped in a single such element. For example, the following are equivalent.
Example 6.2
Alternate styles for using the proto element.
A separate proto element for each prototype
<subform>
<proto>
<color id="RED" value="255,0,0"/>
</proto>
<proto>
<color id="GREEN" value="0,255,0"/>
</proto>
...
</subform>
Prototypes grouped inside a single proto element
<subform>
<proto>
<color id="RED" value="255,0,0"/>
<color id="GREEN" value="0,255,0"/>
</proto>
...
</subform>
Almost any template element can be a prototype. Notable exceptions include the proto and template
elements.
Referencing Prototypes
An element can refer to a prototype through either its (the referencing element’s)
use
or
usehref
attribute. These two attributes have similar effects but
usehref
is more flexible. The
use
attribute can
only refer to an
internal prototype
- a prototype in the same template. By contrast
usehref
can also refer
to an
external prototype
- a prototype in an external document. Any particular element can employ only
one prototype. If both
use
and
usehref
are present and non-empty
usehref
is employed.
The
use
attribute, if it is non-empty, holds a reference to the prototype to be used. The form of the
reference can be either of
#ID
expression
where
ID
is an XML ID string and
expression
is a SOM expression.
For a successful reference to occur, the reference must refer to a single element that is located in the
template packet of the document and is of the same type as the referencing element.
Home Index Bookmark Pages
Pages: Home Index All Pages