XFA Specification
Chapter 6, Template Features for Designing Forms with Repeating Sections
Prototypes
196
a superclass-subclass relationship in an object-oriented language.
HELV-RED
also invokes a color
prototype called
RED
. This achieves the same result as the previous example.
Example 6.4
Nested prototype invocations.
<proto>
<color id="RED" value="255,0,0"/>
<font id="HELV"
typeface="helvetica"
size="10pt"
weight="regular"
posture="upright"
>
</font>
<font id="HELV-RED" use="HELV">
<color use="#RED"/>
</font>
</proto>
<field ...>
<font use="#HELV-RED"/>
...
</field>
Caution:
It is permissible for internal prototypes to reference external prototypes and vice versa. However
when an external prototype references an internal prototype the internal prototype is resolved
within the context of the source document, that is to say the original template. For example, in
the following example a template in the file mytemp.xdp invokes an external prototype
ClientSubform
in
myprot.xdp
. This prototype in turn tries to make use of an internal
prototype
ClientNameField
within
myprot.xdp
. This reference fails to resolve because the
XFA processor tries to resolve it in
mytemplate.xdp
.
Example 6.5
Incorrect application of the use attribute within an external prototype.
Fragment from mytemplate.xdp
<subform name="root">
<subform usehref="myprot.xdp#ClientSubform"/>
</subform>
Fragment from myprot.xdp (incorrect)
<proto>
<subform name="Client" ID="ClientSubform" ... >
<field use="ClientNameField" .../>
</subform>
<field name="ClientName" ID="ClientNameField" .../>
</proto>
The solution is to employ usehref instead of use in myprot.xdp, as follows.
Example 6.6
Corrected external prototype using the usehref attribute.
Fragment from myprot.xdp (corrected)
<proto>
<subform name="Client" ID="ClientSubform" ... >
<field usehref="myprot.xdp#ClientNameField" .../>
Home Index Bookmark Pages
Pages: Home Index All Pages