Instruction
A DPML instruction is identified by the XML element instr
.
The DPML runtime creates a sub-request for each instruction
in the program.
The sub-request is issued into the local address space with the
verb SOURCE
and a URI constructed from elements
within the instr
element.
For example, the following DPML instruction:
<instr>
<type>random</type>
</instr>
will cause the the issuance of a sub-request using the verb SOURCE
and the URI:
active:random
The instr
element must have a type
child
element and may have a target
and one or more argument
child elements.
Reserved Elements
The element names type
and target
have special meaning within the instr
element.
Element |
|
type |
(mandatory)
the service or accessor for this instruction.
|
target |
(optional)
identifies a resource to which the resource-representation
returned in the response is written with a
SINK request.
Specifying a variable with the
var: scheme
will assign the response to a local DPML variable.
If the
target
element is omitted the response
from the request is discarded.
|
Arguments
An instruction may include named arguments.
Named arguments are defined by child elements which have a name
corresponding to the argument name.
For example, the following instruction
<instr>
<type>xslt</type>
<operand>ffcpl:/data.xml</operand>
<operator>ffcpl:/style.xsl</operator>
<target>ffcpl:/result.xml</target>
</instr>
will cause DPML to issue the following SOURCE
request
active:xslt+operand@ffcpl:/data.xml+operator@ffcpl:/style.xsl
and write the result to ffcpl:/result.xml
Literal Arguments
For the special case of XML arguments, the value of the
argument may be written directly in the DPML program.
For example, the previous example could be written in-line as shown in
this DPML program:
<idoc>
<instr>
<type>xslt</type>
<operand>
<customer>
<name>Charles</name>
<phone>800-555-1212</phone>
</customer>
</operand>
<operator>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" />
<xsl:template match="/customer">
<name>
<xsl:value-of select="name" />
</name>
</xsl:template>
</xsl:stylesheet>
</operator>
<target>this:response</target>
</instr>
</idoc>
Literal XML fragments are always passed by reference.
The sub-request will pass the URI of the DPML script with an XPointer
reference to that literal fragment.
DPML Playpen
NetKernel provides a
DPML Playpen
, a tool that allows you to
write DPML programs and execute them to experiment with
the language.
You can copy the source from the example above and paste it into the
DPML Playpen window and hit execute to see the result.