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

RE: (p:data) / p:http-request in p:for-each

From: <Toman_Vojtech@emc.com>
Date: Wed, 2 Dec 2009 08:44:43 -0500
Message-ID: <997C307BEB90984EBE935699389EC41C368D83@CORPUSMX70C.corp.emc.com>
To: <xproc-dev@w3.org>
> <c:request xmlns:c="http://www.w3.org/ns/xproc-step"
> href="file:///home/stefanie/Magisterarbeit/quellcode/xproc/min
> i-test-db/gba/80tage/80tage.htm"/>
> <c:request xmlns:c="http://www.w3.org/ns/xproc-step"
> href="file:///home/stefanie/Magisterarbeit/quellcode/xproc/min
> i-test-db/gba/80tage/80pass.htm"/>

What exactly goes wrong in your case? One thing that I see is that the
HTTP method (method="get") should be set on the c:request document, not
on p:http-request. I don't know if that causes an error in Calabash, but
it should (it is a static error if the method is not specified; or maybe
only in the latest internal spec draft).

But apart from that, I don't see anything obviously wrong with your
pipeline (but note that I haven't run it). The p:http-request seems to
be used properly (except for the method="get" attribute). It will
connect automatically to the "current" input port of p:for-each, and it
will be executed 2 times, once for each c:request document.

Regards,
Vojtech



> 
> This is the current xproc:
> 
> <p:declare-step 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="myPipeline">
>   <p:input port="source" sequence="true"/>
>   <p:output port="result" sequence="true">
>     <p:pipe port="result" step="fileloop"/>
>   </p:output>
> 
>   <!-- declare path -->
>   <p:variable name="path"
> 
> select="'file:///home/stefanie/Magisterarbeit/quellcode/xproc/
> mini-test-db/gba/80tage'">
>     <p:empty/>
>   </p:variable>
> 
>   <!-- list directory -->
>   <p:directory-list name="directories">
>     <p:with-option name="path" select="$path">
>       <p:empty/>
>     </p:with-option>
>   </p:directory-list>
> 
>   <!-- show complete path  -->
> 
>   <p:make-absolute-uris match="c:file/@name" name="uri">
>     <p:with-option name="base-uri" select="p:resolve-uri(concat($path,
> '/',
>       c:file/@name))"/>
>   </p:make-absolute-uris>
> 
>   <p:string-replace match="c:file/@name" replace="replace(., 'file:',
> 'file://')" name="replace">
>     <p:documentation>Fixes the URI so that it can be used by the
> http-request
>       step.</p:documentation>
>   </p:string-replace>
> 
>   <p:rename match="c:file" new-name="c:request"/>
>   <p:rename match="@name" new-name="href"/>
> 
>   <!-- excluding other file types works great -->
>   <p:filter select="//c:request[matches(@href, 'htm')]" 
> name="filter"/>
> 
>   <!-- loop over files and do some html tidy.   -->
> 
>   <p:for-each name="fileloop">
>    <!-- <p:iteration-source select="//c:request"/>-->
>     <!-- This may be obsolete as a filter is defined -->
>     <p:output port="result" sequence="true"/>
> 
>     <p:http-request method="get"/>
> 
>     <p:exec command="/usr/bin/tidy" source-is-xml="false"
> result-is-xml="true"
>       wrap-result-lines="false">
> 
>       <p:with-option name="args"
>         select="'--quiet yes
>         --show-warnings no --doctype omit --numeric-entities yes
> --output-xml
>         yes'"
>       />
>     </p:exec>
> 
>     <p:unwrap match="c:result"/>
> 
>     <p:identity/>
>   </p:for-each>
> 
> </p:declare-step>
> 
> 
> Kind regards,
> Stefanie
> 
> 
> -- 
> Stefanie Haupt
> 
> 
> 
> 
> 
Received on Wednesday, 2 December 2009 13:45:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 2 December 2009 13:45:29 GMT