W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > June 2006

Pipe/Flow Example

From: Alex Milowski <alex@milowski.org>
Date: Thu, 08 Jun 2006 08:11:24 -0700
Message-ID: <44883E1C.1050309@milowski.org>
To: public-xml-processing-model-wg@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:48 GMT