This instruction declares an external program (or DCP script) that contains
node-generation methods. These methods will be invoked during document processing
as dictated by the appearance of subsequent <?
directives (explained below).
Attribute name specifies an author-defined
objectName that will be used to qualify method
names in the DCP script. This name must be unique within the document.
Attribute language specifies the programming
language in which the DCP script is written. Supported values for this attribute
(also referred to as ecmascript).
This attribute is optional; its default value is
java. Other languages may be added in the future. It
is valid for the same XML document to use multiple DCP scripts written in different languages.
Attribute code specifies the actual DCP script
location. Interpretation of this mandatory attribute is language-dependent.
filename relative to the path of the
invoking XML document. The same code can be specified multiple times in
a given document, provided a different objectName is used in
This instruction requests the substitution of its corresponding node by the
return value of a named method defined in a DCP script.
Single-valued, named parameters can be passed to node-generation methods by specifying
additional attributes in the
processing instruction. These attributes are made available to the method through a
Attribute method defines what
method to invoke on a given
object. The object name must have been
associated with a DCP script by means of a previous
processing instruction. Node-generation methods must be public and conform to the following signature:
parameters. A dictionary containing optional named parameters
specified as additional attributes to the
source. The processing instruction node
corresponding to the
directive itself. This is useful for methods that need access to siblings or ancestors in the
Methods can return any type of value, including primitive types, void and
null. Void and null are understood as a request to remove the
corresponding node. Returned values that are instances of org.w3c.Node are
simply inserted into the corresponding DOM tree position. Primitive types and
regular objects are wrapped as strings in org.w3c.Text nodes. Arrays are wrapped as
org.w3c.DocumentFragment's containing as
many children as elements in the array; these elements are recursively wrapped
according to the above rules.