DPML Programs
The DPML language supports the construction and sequencing of
active:
URI requests using an XML based syntax.
A quick introduction to the
DPML Programming Language
and a
DPML By Example
tutorial are provided elsewhere, so a brief introduction
here will describe the essential concept.
A DPML script program is defined within an idoc
XML fragment.
The seq
element contains a sequence of
instr
elements:
<idoc>
<seq>
<instr />
<instr />
</seq>
</idoc>
Each instr
element equates directly to
an active: URI and an associated
SOURCE
and
SINK
pair of requests.
The following active: URI
active:xslt+operator@ffcpl:/src/style.xsl+operand@ffcpl:/context.xml
Is coded in DPML as
<instr>
<type>xslt</type>
<operator>ffcpl:/src/style.xsl</operator>
<operand>ffcpl:/context.xml</operand>
<target>ffcpl:/result.xml</target>
</instr>
The target
element specifies the URI for a SINK
request.
The DPML fragment executes the XSLT transform by issuing a SOURCE
request and then requests a SINK
request on the target using the returned representation.
DPML can be used to chain service calls together as can be done in Unix
using the Unix pipe operator ("|").
For example, the following DPML program
<idoc>
<seq>
<instr>
<type>copy</type>
<operand>ffcpl:/content.xml</operand>
<target>var:temp-content</target>
</instr>
<instr>
<type>xslt</type>
<operator>ffcpl:/src/style.xsl</operator>
<operand>var:temp-content</operand>
<target>var:result</target>
</instr>
</seq>
</idoc>
First copies the content of a file to a temporary variable in the var:
namespace and then uses the as the operand
parameter in the XSLT tranform
service.
DPML script programs are themselves
resources.
A DPML script is run using the following active: URI request:
active:dpml+operator@ffcpl:/src/script.idoc
XML is selected for the DPML syntax because XML is a first-class
resource within NetKernel.
This means that DPML programs could be created from for example, simple XSLT transforms
or other XML operators.