W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2010

Loop over URLs with http-request…how?

From: Tony Rogers <tony@gonk.net>
Date: Wed, 3 Nov 2010 15:19:55 -0400
Message-Id: <E173C9B6-72FB-4F08-8611-91BEDE0E070D@gonk.net>
To: XProc Dev <xproc-dev@w3.org>
Hey everybody,

I'm working on a class project and I need to collect data for it.  I'm trying to use XProc to loop over a bunch of URLs and store the responses, but I am practically banging my head against the wall trying to figure out how to do this simple thing.  Could anybody give me a hint?  :)

Here's my pipeline:

<?xml version='1.0' encoding='UTF-8'?>
<pipeline 
    xmlns="http://www.w3.org/ns/xproc" 
	xmlns:local="#empty" 
    xmlns:p="http://www.w3.org/ns/xproc"
	xmlns:c="http://www.w3.org/ns/xproc-step"
	xmlns:cx="http://xmlcalabash.com/ns/extensions"
	name="INFM298I-data-collection"
    version="1.0">
    
    
    <import href="http://xmlcalabash.com/extension/steps/library-1.0.xpl" />
    
    
    <group>
        <variable name="forum-url-prefix"   select="'http://us.battle.net/sc2/en/'"/>
        
        <variable name="general"            select="concat($forum-url-prefix,'forum/40568/')"/>
        <variable name="wol-campaign"       select="concat($forum-url-prefix,'forum/13432/')"/>
        <variable name="terran"             select="concat($forum-url-prefix,'forum/13433/')"/>
        <variable name="protoss"            select="concat($forum-url-prefix,'forum/13434/')"/>
        <variable name="zerg"               select="concat($forum-url-prefix,'forum/13435/')"/>
        <variable name="multiplayer-and-esports"    
                                            select="concat($forum-url-prefix,'forum/13436/')"/>
        <variable name="custom-maps"        select="concat($forum-url-prefix,'forum/13437/')"/>
        <variable name="blizzcon"           select="concat($forum-url-prefix,'forum/692681/')"/>
        
        <for-each>
            <iteration-source 
                select="
                    $general, 
                    $wol-campaign,
                    $terran,
                    $protoss,
                    $zerg,
                    $multiplayer-and-esports,
                    $custom-maps,
                    $blizzcon
                    " 
            />
            
            <http-request>
                <input port="source">
                    <inline>
                        <c:request method="GET" detailed="true"
                            href="http://us.battle.net/sc2/en/forum/40568/">
                            
                        </c:request>
                    </inline>
                </input>
            </http-request>
        </for-each>
    </group>
	
    <sink />

</pipeline>
Received on Wednesday, 3 November 2010 19:20:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 November 2010 19:20:24 GMT