W3C home > Mailing lists > Public > xproc-dev@w3.org > April 2009

Here's an example of a pipeline that interacts with multiple RSS feeds

From: Costello, Roger L. <costello@mitre.org>
Date: Sun, 26 Apr 2009 11:41:24 -0400
To: "'xproc-dev@w3.org'" <xproc-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5003F245AA5D@IMCMBX3.MITRE.ORG>

Hi Folks,

I created an XProc pipeline which illustrates interacting with multiple web services that serve up RSS documents, and making dynamic decisions based on the content of the RSS documents.

My pipeline does this:

   Invoke a weather service to get the weather for today

   If today's weather is not forecasted to be sunny then:

       Invoke a movie service to get a list of movies currently playing
 
   Else

       Invoke a traffic service to get local traffic conditions
       (I'm heading to the beach)

   Style the results 


Here's a graphic which shows the pipeline:

http://www.xfront.com/orchestrating-multiple-RSS-feeds.gif


The .xpl file is below. If you would like to run the pipeline, here are all the files:

http://www.xfront.com/orchestrating-multiple-RSS-feeds.zip

/Roger


<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
                xmlns:c="http://www.w3.org/ns/xproc-step">
    <p:input port="source">
        <p:document href="Me.xml"/>
    </p:input>
    <p:output port="result" />

    <p:xslt>
        <p:input port="source"/>
        <p:input port="stylesheet">
            <p:document href="Create-Weather-Request.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>

    <p:http-request />
    
    <p:choose>
        <p:when test="not(contains(//item[1]/title, 'sunny'))">
            <p:xslt>
                <p:input port="source"/>
                <p:input port="stylesheet">
                    <p:document href="Create-Movie-Request.xsl"/>
                </p:input>
                <p:input port="parameters">
                    <p:empty/>
                </p:input>
            </p:xslt> 
        </p:when>
        <p:otherwise>
            <p:xslt>
                <p:input port="source">
                   <p:document href="Me.xml"/>
                </p:input>
                <p:input port="stylesheet">
                    <p:document href="Create-Traffic-Request.xsl"/>
                </p:input>
                <p:input port="parameters">
                    <p:empty/>
                </p:input>
            </p:xslt> 
        </p:otherwise>
    </p:choose>

    <p:http-request />

    <p:xslt>
        <p:input port="source"/>
        <p:input port="stylesheet">
            <p:document href="RSS.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>

</p:declare-step> 
Received on Sunday, 26 April 2009 15:42:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 26 April 2009 15:42:03 GMT