Pipe/Flow Example

Based on a suggestion from Norm:

"A pipe that takes a document, stylesheet, and schema, validates the doc 
with the schema, applies the stylesheet and returns the result where all 
three documents are inputs to the pipeline."

<pipe>
    <input name="in.document" primary="true"/>
    <input name="in.schema"/>
    <input name="in.stylesheet"/>
    <step name="validate">
       <input name="schema" ref="in.document"/>
    </step>
    <step name="xslt">
       <input name="stylesheet" ref="in.stylesheet"/>
    </step>
</pipe>


A more interesting twist is when the stylesheet is choosen based on the
document:

<flow>
    <input name="in.document" primary="true"/>
    <input name="in.schema"/>
    <output name="out.result"/>

<pipe>
    <input name="in.document"/>
    <choose>
       <when test="/article">
          <step process="get-resource">
             <parameter name="href" value="article.xsl"/>
          </step>
       </when>
       <when test="/paper">
          <step process="get-resource">
             <parameter name="href" value="paper.xsl"/>
          </step>
       </when>
       <otherwise>
          <step process="get-resource">
             <parameter name="href" value="default.xsl"/>
          </step>
       </otherwise>
    </choose>
    <output name="p.stylesheet"/>
</pipe>


<pipe>
    <input name="in.document" primary="true"/>
    <input name="in.schema"/>
    <input name="p.stylesheet"/>
    <step name="validate">
       <input name="schema" ref="in.document"/>
    </step>
    <step name="xslt">
       <input name="stylesheet" ref="in.stylesheet"/>
    </step>
</pipe>

</flow>

We could also allow single steps, as we do now, as parts of the flow so 
that you don't have to have a pipe with a single step.

--Alex Milowski

Received on Thursday, 8 June 2006 15:11:35 UTC