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

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 UTC