Extension element

Murray asked for a pipeline that used an extension element for
something other than documentation.

Suppose I have a set of extension steps that can access some
proprietary database or server or something. In order to do that,
they need login credentials. Instead of requiring the author to
pass those credentials to every step, I adopt the convention
that the default credentials will come from an element with the
name <ex:credentials> in the pipeline:

<p:pipeline name="pipeline" xmlns:p="http://www.w3.org/2007/03/xproc"
            xmlns:exc="http://example.org/credentials"
            xmlns:ex="http://example.org/steps"
            p:ignored-prefixes="ex">
<p:input port="stylesheet"/>
<p:output port="result"/>

<exc:credentials>
  <exc:login>ndw</exc:login>
  <exc:password>PASSWORD</exc:password>
</exc:credentials>

<p:declare-step type="ex:read-database" ex:class="org.example.java.Class">
  <p:output port="result" sequence="no"/>
</p:declare-step>

<ex:read-database name="dbread">
  <p:option name="database" value="userlist"/>
</ex:read-database>

<p:xinclude name="xinc">
  <p:input port="source">
    <p:pipe step="dbread" port="result"/>
  </p:input>
</p:xinclude>

<p:validate name="valid">
  <p:input port="schema">
    <p:document href="http://example.com/path/to/schema.xsd"/>
  </p:input>
</p:validate>

<p:xslt name="xform">
  <p:input port="stylesheet">
    <p:pipe step="pipeline" port="stylesheet"/>
  </p:input>
</p:xslt>

</p:pipeline>

This example is a little silly because it always uses an extension
step, but suppose I'd been a little more clever and put it in choose.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 22 March 2007 19:59:22 UTC